MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / has_dualstack_ipv6

Function has_dualstack_ipv6

tools/python-3.11.9-amd64/Lib/socket.py:860–873  ·  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

858
859
860def has_dualstack_ipv6():
861 """Return True if the platform supports creating a SOCK_STREAM socket
862 which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
863 """
864 if not has_ipv6 \
865 or not hasattr(_socket, 'IPPROTO_IPV6') \
866 or not hasattr(_socket, 'IPV6_V6ONLY'):
867 return False
868 try:
869 with socket(AF_INET6, SOCK_STREAM) as sock:
870 sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
871 return True
872 except error:
873 return False
874
875
876def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,

Callers 1

create_serverFunction · 0.85

Calls 2

socketClass · 0.85
setsockoptMethod · 0.80

Tested by

no test coverage detected