MCPcopy Index your code
hub / github.com/python/cpython / has_dualstack_ipv6

Function has_dualstack_ipv6

Lib/socket.py:888–901  ·  view source on GitHub ↗

Return True if the platform supports creating a SOCK_STREAM socket which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.

()

Source from the content-addressed store, hash-verified

886
887
888def has_dualstack_ipv6():
889 """Return True if the platform supports creating a SOCK_STREAM socket
890 which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
891 """
892 if not has_ipv6 \
893 or not hasattr(_socket, 'IPPROTO_IPV6') \
894 or not hasattr(_socket, 'IPV6_V6ONLY'):
895 return False
896 try:
897 with socket(AF_INET6, SOCK_STREAM) as sock:
898 sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
899 return True
900 except error:
901 return False
902
903
904def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,

Callers 1

create_serverFunction · 0.85

Calls 2

socketClass · 0.70
setsockoptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…