SimpleRPCServer

robin escalation746 at yahoo.com
Sun Apr 3 21:41:59 EDT 2005


Skip Montanaro <skip at pobox.com> wrote:

>First, from my reading of SimpleXMLRPCServer, I don't think _dispatch()
>belongs at that level.  It belongs in the request handler class or in a
>separate dispatcher class, depending on what version of Python you're using.

Quite so. As a variant I just use verify_request() to persist the
client IP address, and then wait until _dispatch() to do everything
else.

class RPCServer(SimpleXMLRPCServer):
	def verify_request(self, handler, address):
		self.client_ip, self.client_port = address
		return True

	def _dispatch(self, method, args):
		do_something(self.client_ip)

Though using a firewall would not be remiss. :-)

-- robin



More information about the Python-list mailing list