[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

xmlrpclib, testing server presence

Rock

2/2/2008 8:22:00 AM

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.
1 Answer

Trevor Hennion

2/2/2008 3:34:00 PM

0

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.infocentra...