[issue17561] Add socket.create_server_sock() convenience function
Giampaolo Rodola'
report at bugs.python.org
Wed Mar 27 21:01:09 CET 2013
Giampaolo Rodola' added the comment:
Side note: this is how in pyftpdlib I determine whether a platform supports the dual stack:
def support_hybrid_ip_v4_v6():
# Note: IPPROTO_IPV6 constant is broken on Windows, see:
# http://bugs.python.org/issue6926
sock = None
try:
if not socket.has_ipv6:
return False
sock = socket.socket(socket.AF_INET6)
return not sock.getsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY)
except (socket.error, AttributeError):
return False
finally:
if sock is not None:
sock.close()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17561>
_______________________________________
More information about the Python-bugs-list
mailing list