how best to handle httplib timeouts ?

Rich rich at mchsi.com
Tue Jul 29 23:58:10 EDT 2003


Hi all,

I'm trying to write an app to monitor an IIS server, by connecting and
getting a page via httplib. the problem seems to be when IIS (or ASP) dies
httplib does not always return and sometimes I'm left with an app that
hangs. what is the best way to handle this ?

thanks,
rich.

the code looks like this:

try:
    res = h.getresponse()
    dat = res.read()
    sFlag = sFlag + 1
except:
    if debug > 0:
        WriteLog(' Error receiving a response from 2nd mailbox page
request')
    h.close()
    return sFlag







More information about the Python-list mailing list