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

Sean 'Shaleh' Perry shalehperry at attbi.com
Tue Apr 2 21:26:38 EST 2002


On 03-Apr-2002 Ralph wrote:
> 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?
> 
> Thanks as always.
> 

a select loop is a common way to wait for data on a socket and specify a
timeout.  Look for documentation on select().




More information about the Python-list mailing list