xmlrpclib, testing server presence

Trevor Hennion joe at example.com
Sat Feb 2 16:34:03 CET 2008


On Sat, 02 Feb 2008 00:22:15 -0800, rocco.rossi wrote:

> I'm employing xmlrpclib for a project at work, and I must say that I'm
> quite impressed with its effectiveness and ease of use.
> 
> However, I was recently doing some tests when I realized that if the
> server was down, the client quite simply hanged (no use of "try ...
> except" here) with no error or tracebacks or exceptions whatsoever.
> 
> Is there some way in Python of "testing" the presence of the server on
> the other end, so as to avoid this situation?
> 
> Thank you.

Hi,

Could you test for a socket timeout?:

socket.setdefaulttimeout(20.0) # timeout = 20.0 secs

regards

Trevor
http://www.infocentrality.co.uk



More information about the Python-list mailing list