()
Return True if the platform supports creating a SOCK_STREAM socket
    which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
Return True if the platform supports creating a SOCK_STREAM socket
    which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
Return True if the platform supports creating a SOCK_STREAM socket which can handle both AF_INET and AF_INET6 ( IPv4 / IPv6 ) connections .
def has_dualstack_ipv6():
    """Return True if the platform supports creating a SOCK_STREAM socket
    which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
    """
    if not has_ipv6 \
            or not hasattr(_socket, 'IPPROTO_IPV6') \
            or not hasattr(_socket, 'IPV6_V6ONLY'):
        return False
    try:
        with socket(AF_INET6, SOCK_STREAM) as sock:
            sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
            return True
    except error:
        return False
def has_dualstack_ipv6 ( ) : if not has_ipv6 or not hasattr ( _socket , 'IPPROTO_IPV6' ) or not hasattr ( _socket , 'IPV6_V6ONLY' ) : return False try : with socket ( AF_INET6 , SOCK_STREAM ) as sock : sock . setsockopt ( IPPROTO_IPV6 , IPV6_V6ONLY , 0 ) return True except error : return False