gsoap does not serve over both ipv4 and ipv6

506 views Asked by At

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?

2

There are 2 answers

0
rotringuser On BEST ANSWER

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.

0
Simon On

Just came across this exact same issue.

Turns out it is supported.

Just define WITH_NO_IPV6_V6ONLY. (Which results in WITH_IPV6 being defined 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.