SimpleXMLRPCServer and creating a new object on for each new client request.

Piet van Oostrum piet at cs.uu.nl
Thu May 7 19:17:08 EDT 2009


>>>>> Jelle Smet <jelle at smetj.net> (JS) wrote:

One more thing:

>JS> I start python interactively:
>>>>> import xmlrpclib
>>>>> session1=xmlrpclib.ServerProxy('http://localhost:8000')
>>>>> session2=xmlrpclib.ServerProxy('http://localhost:8000')
>>>>> print session1.show_random()
>JS> 13930
>>>>> print session2.show_random()
>JS> 13930
>>>>> 

I get the impression, also from your use of the variable names
'session1' and 'session2' that xmlrpclib.ServerProxy() gives you some
kind of connection to the XMLRPC server. This is not the case. It gives
just an administration object *in the client* that will communicate with
the server when you call a method on it. The two session's in your code
are therefore functionally equivalent and there is no advantage in
having two of them instead of one. And the name session is misleading.

Please note also that XMLRPC isn't object-oriented. There is just the
server; in the protocol there are no objects other than the server.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list