On 12/13/2011 07:26 PM, Sven Geggus wrote:
Hello,

to support dual stack I just changed my code from:

MHD_start_daemon(MHD_NO,...
to
MHD_start_daemon(MHD_USE_IPv6,...

Unfortunately the daemon seems to be ipv6 _only_ now.

How ist this supposed to work?

 From generic socket-programming I usually assume AF_INET6 on to
serverside to be both IPv4 and IPv6. Is this different as far as
libmicrohttpd is concerned?

Yes, assuming an IPv6-socket is for both v4 and v6 is considered bad style and will NOT work on all OSes (and on Linux it'll only work if your kernel uses a particular, outdated configuration).

The correct way to get dual-stack is to call MHD_start_daemon twice, once for IPv4 and once for IPv6.

If you want to insist on one listen-socket for both v4 and v6, you can still force that by doing the bind/listen manually yourself (with the right socket options and appropriate amount of praying) and then give that pre-bound listen socket to MHD (MHD_OPTION_LISTEN_SOCKET). But again, this is NOT the recommended or portable approach.

Happy hacking,

Christian

Reply via email to