SimpleXMLRPCServer and client address

Jordan Apgar twistedphrame at gmail.com
Wed Feb 10 17:19:50 EST 2010


I'm trying to right a server that needs specific information for each
client accessing it.  The easiest way I could think of doing this is
keeping this information based on ip address (the information is only
valid for a short time).  I know there is no was to get the client's
address directly and have seen a few examples of subclassing the
SimpleXMLRPCServer like this:

class RPCServer(SimpleXMLRPCServer):

def _dispatch(self, method, params):
"""Extend dispatch, adding client info to some parameters."""
if method in ({my list of methods I needed client address}):
return SimpleXMLRPCServer._dispatch(self, method,
params+(self.client_address,))
return SimpleXMLRPCServer._dispatch(self, method, params);


but to be honest I don't understand what's going on there or how to
use it.  Would anyone be able to explain this to me?



More information about the Python-list mailing list