MCPcopy Index your code
hub / github.com/RustPython/RustPython / has_dualstack_ipv6

Function has_dualstack_ipv6

Lib/socket.py:879–892  ·  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

877
878
879def has_dualstack_ipv6():
880 """Return True if the platform supports creating a SOCK_STREAM socket
881 which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
882 """
883 if not has_ipv6 \
884 or not hasattr(_socket, 'IPPROTO_IPV6') \
885 or not hasattr(_socket, 'IPV6_V6ONLY'):
886 return False
887 try:
888 with socket(AF_INET6, SOCK_STREAM) as sock:
889 sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
890 return True
891 except error:
892 return False
893
894
895def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,

Callers 1

create_serverFunction · 0.85

Calls 3

hasattrFunction · 0.85
socketClass · 0.70
setsockoptMethod · 0.45

Tested by

no test coverage detected