xml-rpc timeout

Steve Holden steve at holdenweb.com
Fri Sep 21 15:21:58 EDT 2007


Jd wrote:
> Steve Holden wrote:
>> Jd wrote:
>>> Hi
>>>    I have a multi-threaded application. For certain operations to the
>>> server, I would like to explicitly set timeout so that I get correct
>>> status from the call and not timed out exception.
>>>    Does anyone know how to go about doing it ?
>>>
>> The easiest way is to use socket.setdefaulttimeout() to establish a
>> longer timeout period for all sockets, I guess. It's difficult to
>> establish different timeouts for individual sockets when they aren't
>> opened directly by your own code (though each socket does also have a
>> method to set its timeout period).
>>
>> regards
>>  Steve
> 
> Ya.. the problem here is that I donot have acces to the socket. I have
> written my own transport etc.. but when the socket is getting created,
> there is no context for the method and where I know what method I am
> going to call, I do not have access to socket.
> 
But you are writing Python, so you can write

import socket
socket.setdefaulttimeout(60)

and this will apply to all sockets that on't have their own explicit 
timeouts applied. Give it a try.

> I would have thought this to be an easy thing to achieve. In order to
> make xml-rpc easy to use.. it has become difficult to control.
> 
You might also ask why your server *is* timing out. Timeouts shouldn't 
be a normal feature of TCP communications. Is there a reason of rthis 
anomalous behavior, or are you perhaps trying to solve the wrong problem?

> Anyone have any other ideas ?
> 
That's all from me!

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline




More information about the Python-list mailing list