That makes an AF_INET socket which can only connect to IPv4 hosts.
The app should use an AV_INET6 socket with the IPV6_V6ONLY flag set to 0, so that the socket can connect to both IPv6 and IPv4 hosts (by passing around the IPv4 addresses as IPv4-mapped IPv6 addresses.
I'm not quite sure what happens when you just throw a hostname at the Python socket connect in such a situation, and whether it is smart about resolving hosts with both IPv4 and IPv6 addresses available. You might need to call getaddrinfo yourself with AI_V4MAPPED in order to get IPv4-mapped addresses from a hostname.
This app uses a default-constructed socket for its communications. The default socket constructor looks like this:
That makes an
AF_INET
socket which can only connect to IPv4 hosts.The app should use an
AV_INET6
socket with theIPV6_V6ONLY
flag set to 0, so that the socket can connect to both IPv6 and IPv4 hosts (by passing around the IPv4 addresses as IPv4-mapped IPv6 addresses.I'm not quite sure what happens when you just throw a hostname at the Python socket connect in such a situation, and whether it is smart about resolving hosts with both IPv4 and IPv6 addresses available. You might need to call
getaddrinfo
yourself withAI_V4MAPPED
in order to get IPv4-mapped addresses from a hostname.