
David G Mills wrote:
First off I'd like to point out that when host is set to a fully qualified domain name, comp.foo.org for example, the correct behaviour is seen, getaddrinfo returns an IPv4 and IPv6 address, and when the socket is created, it binds to the IPv6 address. Only when localhost is used does it fail to find an IPv6 address. Now there's nothing wrong with the /etc/hosts file, as I tested with the one from the working machine. Also when using AF_INET6 and host=localhost it works fine, which is why I am puzzled.
Ah, ok. It wasn't quite clear to me what specifically you consider an error. As Evan Jones says, Python returns the data in the very same way in which the C library returns them
Thanks for the glibc information, I shall investigate down that path and see what I can discover, but if you can think of anything else that might be causing this I'd like to hear it. =)
On my system, it would be /etc/hosts, which reads 127.0.0.1 localhost mira ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts So I find it perfectly ok that "localhost" only resolves to IPv4. Regards, Martin