Socket timeouts for HTTP connections (httplib)?

Dave Brueck dave at pythonapocrypha.com
Wed Apr 2 12:21:34 EST 2003


On Wed, 2 Apr 2003, nick wrote:

> I have neither an expert understanding of socket programming,
> threading or asyncronous IO, yet can get by using threading.Thread and
> httplib.  I am therefore looking for a timeout at a fairly high level
> (ie the httplib api).
>
> There were rumblings about Guido implementing this at a socket level
> in June 2002, but I've not been able to find anything since.

In newer versions of Python sockets can have timeouts, but someone
recently posted that they don't work for the high-level APIs.

> Has/is someone involved with this?  timeoutsocket simply doesn't work
> for me and throws continuous "connection reset by peer" exceptions.
> So I'm completely stuck for options.

Maybe the best thing to do is to post some code that exhibits this
problem, because many people have used timeoutsocket with the higher level
APIs and had lots of success with it. You _should_ be able to just drop it
into your code and catch the appropriate timeout exception, so getting it
to work is probably your best bet.

-Dave





More information about the Python-list mailing list