[英]gsoap does not serve over both ipv4 and ipv6
I am trying to implement a gsoap server that listens same port over both ipv4 and ipv6, but it does not listed in " netstat -l
" command as tcp6 although I compiled gsoap with -DWITH_IPV6 -DWITH_NO_IPV6_V6ONLY
macro definitions." netstat -l
" command has tcp listenning server. 我正在尝试实现一个可同时通过ipv4和ipv6侦听相同端口的gsoap服务器,但是尽管我使用
-DWITH_IPV6 -DWITH_NO_IPV6_V6ONLY
宏定义编译了gsoap,但它并未在tcp6的“ netstat -l
”命令中列出。“ netstat -l
”命令有TCP监听服务器。 When I compile code with -DWITH_IPV6 -DWITH_IPV6_V6ONLY
macros it works with only Ipv6 and " netstat -l
" response has tcp6 listenning server. 当我使用
-DWITH_IPV6 -DWITH_IPV6_V6ONLY
宏编译代码时,它仅适用于Ipv6,并且“ netstat -l
”响应具有tcp6侦听服务器。
When I debug the code I saw that soap_bind
function passes ai_family = PF_UNSPEC
through getaddrinfo
, and it does not use ai_next
of returned addrinfo data. 当我调试代码时,我看到
soap_bind
函数通过getaddrinfo
传递ai_family = PF_UNSPEC
,并且它不使用返回的addrinfo数据的ai_next
。 addrinfo.ai_family set to AF_INET, addrinfo.ai_next->ai_family set to AF_INET6 and it does not use addrinfo.ai_next
. addrinfo.ai_family设置为AF_INET,addrinfo.ai_next-> ai_family设置为AF_INET6,并且不使用
addrinfo.ai_next
。
Is there any way to succeed this with/out patching gsoap source code? 有什么方法可以通过/不修补gsoap源代码来成功实现?
As far as I research there is no possible way to bind and listen over two address family AF_INET and AF_INET6 using gsoap. 据我研究,尚无法使用gsoap绑定和侦听两个地址族AF_INET和AF_INET6。 To achieve my subject I made two soap object and bind over different sockets (one is ipv4, other is ipv6) using my modified soap_bind function.
为了达到我的主题,我使用修改后的soap_bind函数制作了两个soap对象并绑定到不同的套接字(一个是ipv4,另一个是ipv6)上。
Just came across this exact same issue. 刚遇到这个完全相同的问题。
Turns out it is supported. 事实证明它是受支持的。
Just define WITH_NO_IPV6_V6ONLY
. 只需定义
WITH_NO_IPV6_V6ONLY
。 (Which results in WITH_IPV6
being defined stdsoap2.h) (这导致
WITH_IPV6
被定义为stdsoap2.h)
That results in setting an option on the socket that allows a dual-stack socket. 这将导致在套接字上设置允许双栈套接字的选项。 As far as I can see, depending on the system that may be the default.
据我所知,这可能是默认系统。 It's not under Windows and you'll need Vista or greater for dual stack support.
它不在Windows下,并且您需要Vista或更高版本才能支持双堆栈。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.