A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2007-March/072163.html below:

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

[Python-Dev] Adding timeout to socket.py and httplib.py [Python-Dev] Adding timeout to socket.py and httplib.pyGreg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 20 23:51:00 CET 2007
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.

Hmmm. I think that this case probably isn't what people
will have in mind when they specify a timeout for connecting.
More likely they mean "If the connection couldn't be successfully
established within this time, give up and let me know."

So it seems to me that a return value of EAGAIN should be
handled internally by re-issuing the connect call with a
suitably reduced timeout value. If the timeout gets down
to zero without a successful result, throw an exception.

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.

--
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4