Very slow opening of client connections to localhost with httplib
Jarkko Torppa
torppa at staff.megabaud.fi
Sat Dec 13 14:32:50 EST 2003
In article <8ce71920.0312120951.4c49b061 at posting.google.com>, Martin Fuzzey wrote:
> I am using xmlrpclib (based on httplib) in Python 2.3 on Mandrake
> Linux.
>
> When my client attempts to connect to a server using a
> "http://localhost:port" style URL there is a long delay before the
> connection is established (it finally works).
...
> import socket
> socket.getaddrinfo("localhost", 10000, 0, socket.SOCK_STREAM)
>
> and sure enough it blocked for several seconds before finally
> returning 127.0.0.1
>
> If I remplace the 0 in the getaddrinfo call above by socket.AF_INET
> all is fine as well.
Try adding
::1 localhost
to your /etc/hosts
Or delete IPv6 from your kernel.
--
Jarkko Torppa, Elisa Internet
More information about the Python-list
mailing list