download timeout vs. socket timeout

Giampaolo Rodola' gnewsg at gmail.com
Sat Jan 10 14:37:42 EST 2009


On 10 Gen, 03:07, "p." <ppetr... at gmail.com> wrote:
> 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?

You could retrieve your file in little parts and at the same time have
a thread which checks how many bytes have been transmitted every
second.


--- Giampaolo
http://code.google.com/p/pyftpdlib



More information about the Python-list mailing list