[Python-Dev] Adding timeout to socket.py and httplib.py

Josiah Carlson jcarlson at uci.edu
Wed Mar 21 00:20:10 CET 2007

Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Alan Kennedy wrote:
> > The standard mechanism in C for doing a non-blocking connect is to
> > issue the connect call, and check the return value for a non-zero
> > error code. If this error code is errno.EAGAIN (code 10035), then the
> > call succeeded, but you should check back later for completion of the
> > operation.
> An application that wants to do fully asynchronous connects
> will have to take quite a different approach, so there
> should probably be a different API for this.

*cough* asyncore or twisted *cough*

Sorry, what were we talking about again?  Oh yeah, timeouts.  From what
I understand of connect and connect_ex, if a socket has a specified
timeout, it is supposed to "try" (it only attempts once, and waits for a
response) until it either fails (because the other end won't accept), or
it times out.  Either case is perfectly fine, and I don't really see the
point of retrying (in socket.create_connection).

 - Josiah

More information about the Python-Dev mailing list