How to wait only so long for a server to respond?

Jeff Shannon jeff at ccvcorp.com
Wed Apr 3 14:10:56 EST 2002


In article 
<nwtq8.11707$ml2.924462 at newsread1.prod.itd.earthlink.net>, 
ralph at penguin.com says...
> Pythoners:
> 
> I have some code that requests a response from a server on the Internet, 
> but I only want to wait so long for the server to respond.  How can I tell 
> python to wait x seconds/minutes, then move on to the next section of code 
> if the server has not responded?

Look for timeoutsocket.py -- I don't know the proper address to 
look at, but Google should find it.

(As I understand it, it's a drop-in replacement for the socket 
module that allows an optional timeout value to be specified.)

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list