download timeout vs. socket timeout
google at mrabarnett.plus.com
Sat Jan 10 03:26:48 CET 2009
> i'm using urllib2 in python 2.4
> wondering how people typically deal with the case in which a download
> is too slow. setting the socket timeout only covers those cases where
> there is no response in the socket for whatever the timeout period is.
> what if, however, i'm getting bits back but want simply to bail out if
> the total time to download takes too long?
> i'm trying to avoid creating a whole other thread if possible?
Don't try to download all the data in one go, but do it a chunk at a
time. If you calculate that it would take too long to complete, then stop.
More information about the Python-list