Overview:
- If creating a TCP/UDP socket which can support both IPv4 and IPv6 based client connections is possible, then the method has_dualstack_ipv6() returns True.
- It returns False if the platform supports only IPv4.
Example - UDP Server:
# Example Python program that uses dualStacked = socket.has_dualstack_ipv6() inet6Address = "2402:e280:215d:21b:f473:ead9:e6d7:3afd" # Create an UDP socket with AF_INET4 or AF_INET6 # Print messages received from UDP clients |
Server Output:
The platform supports sockets in IPv4 & IPv6:True Listening for Datagrams: Client at ('2402:e280:215d:21b:f473:ead9:e6d7:3afd', 59797, 0, 0) has sent:ping
Listening for Datagrams: |
Client & Client output:
echo ping | nc -u 2402:e280:215d:21b:f473:ead9:e6d7:3afd 1235 pinging back... |