[Python-Dev] socket.create_connection slow

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Jan 14 14:31:42 CET 2009


The fix is for the unittest only, where a server is started on a separate thread using
Ipv4 on localhost.

Now, the problem I was describing in the mail isn't specific to xmlrpc, but for
Anyone that wants to use socket.create_connection() to create a stream socket to a host whose name has both an Ipv4 and Ipv6 address.  Unless the host is listening on its Ipv6 port, an unsuccessful connection attempt will first be made, taking approximately one second.

Kristján

-----Original Message-----
From: python-dev-bounces+kristjan=ccpgames.com at python.org [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On Behalf Of Antoine Pitrou
Sent: 14. janúar 2009 11:34
To: python-dev at python.org
Subject: Re: [Python-Dev] socket.create_connection slow

Kristján Valur Jónsson <kristjan <at> ccpgames.com> writes:
> 
> On Vista, it will 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.
> 
> Now, I did fix this in test_xmlrpc.py by just speficying the
> loopback address, but I wonder if this might not be a problem in general?

Is the fix ok? What if the user wanted to connect to an XMLRPC server using IPv6?

> 2)     
> Have the SocketServer create a listening socket for
> each address family by default.

I don't see how that fixes the root of the problem, not all XMLRPC servers are
implemented using SocketServer.


_______________________________________________
Python-Dev mailing list
Python-Dev at python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/kristjan%40ccpgames.com


More information about the Python-Dev mailing list