Search code examples
c++socketsipv6ipv4gsoap

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. When I compile code with -DWITH_IPV6 -DWITH_IPV6_V6ONLY macros it works with only Ipv6 and "netstat -l" response has tcp6 listenning server.

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. addrinfo.ai_family set to AF_INET, addrinfo.ai_next->ai_family set to AF_INET6 and it does not use addrinfo.ai_next.

Is there any way to succeed this with/out patching gsoap source code?


Solution

  • 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. 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.