Charles-François Natali added the comment: > What you say is right but whether the kernel supports an hybrid IPv4/6 stack > or not there's not much we can do about it anyway. > Exactly what are you suggesting with the ServerSocket class you mentioned? > What do you expect it to do?
There's a confusion. Dual-stack merely means that the host supports both IPv4 and IPv6 natively. The IPV6_V6ONLY tunable is just a way to enable or not IPv4-mapped addresses (i.e. ::ffff::<IPv4 address>) so that an IPv4 client can connect to this socket. It can be set system-wide, or on a socket basis. > Note that platforms supporting the dual-stack are already supported. This: > >>>> socket.create_server_socket(("::", 0)) > > ...on Linux will create a socket which is reachable both as "::1" and > "127.0.0.1". Try the same thing after: # echo 1 > /proc/sys/net/ipv6/bindv6only It won't accept IPv4 connections anymore. And that's the default on many (most) platforms, e.g. FreeBSD and OpenBSD (I think it's also true for Windows). So the bottom line is that with the current code, on some - most - platforms, we'll only accept IPv6 connections (and since you iterate over getaddrinfo() in an unspecified order you may very well bind to IPv4 only first, in which case you'll only accept IPv4 clients). The proper way to procedd, on platforms which don't support unsetting IPV6_V6ONLY, is to use two sockets, one in IPv4, and one IPv6, and use select() to accept connections. This would propably belong to an overriden accept() method in a ServerSocket class, since it's far from trivial. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17561> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com