Closed uzlonewolf closed 5 years ago
A significant change this patch causes is when an empty string is given as the bind address - in that case it only uses IPv6 with IPv4-mapped IPv6 addresses ( https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses ) for IPv4 clients. Some operating systems, namely Win XP, Server 2003, and OpenBSD, do not allow IPv4-mapped IPv6; for those you will need to set the bind address to 0.0.0.0 to force IPv4-only. Alternately, changing fam = socket.AF_INET6
to fam = socket.AF_INET
will revert it to the old IPv4-only behavior.
Make use of socket.getaddrinfo() to support IPv6 and passing hostnames as the bind address. If a name cannot be resolved socket.getaddrinfo() will throw a
socket.gaierror: [Errno -2] Name or service not known
. If a name resolves to multiple addresses it will use the first one returned.