Victor Stinner wrote:
Hi,
Le Wednesday 14 January 2009 12:23:46 Kristján Valur Jónsson, vous avez
écrit :
socket.create_connection() trying to connect to ("localhost", port)
(...)
return an AF_INET6 entry before the AF_INET one and try connection
to that. This connect() attemt fails after approximately one second,
after which we proceed to do an immediately successful connect() call
to the AF_INET address.
This is the normal behaviour of dual stack (IPv4+IPv6): IPv6 is tried before
IPv4. SocketServer uses AF_INET by default, so the "IPv6 port" is closed on
your host. Why does it take so long to try to connect to the IPv6 port? On
Linux, it's immediate:
----
$ time nc6 ::1 8080
nc6: unable to connect to address ::1, service 8080
real 0m0.023s
user 0m0.000s
sys 0m0.008s
----
On my host (Ubuntu Gutsy), "localhost" name has only an IPv4 address. The
address "::1" is "ip6-localhost" or "ip6-loopback".
You should check why the connect() to IPv6 is so long to raise an error. About
the test: since SocketServer address family is constant (IPv4), you can force
IPv4 for the client.
This is something of a bugbear on Vista in general. Doing local
web-development with localhost can be really painful until you realise
that switching to 127.0.0.1 solves the problem...
Michael
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com