SimpleXMLRPCServer and socket

Juju jujucece at gmail.com
Tue Sep 26 03:57:05 EDT 2006


Hi,

2006/9/25, Fredrik Lundh <fredrik at pythonware.com>:
> I don't have time to dig deeper into this right now, but this post might
> be helpful:
>
>     http://article.gmane.org/gmane.comp.python.general/471411

I tried to override the "verify_request" method, it managed to get the
ClientAddress, but in this method, the Server is not yet Multithreaded
so I couldn't detect which ClientAddress correspond to which Thread.

So I look more closely at the code (TCPServer, SimpleXMLRPCServer...)
and I finally manage to do what I wanted to do, with overriding the
"finish_request" method and storing the ClientAddresses in a dict
(with the Thread ID as the key) :

--
def finish_request(self, request, client_address):
  # Override the finish_request to collect the client address
  self.dictClientAddress[str(thread.get_ident())]=client_address
  SimpleXMLRPCServer.SimpleXMLRPCServer.finish_request(self, request,
client_address)
--

And now it works !

But I still have a little question :

How can I do to know which method I should override to make the things work ?

Usually, I look at "python.org" but in this case, I couldn't find what
I was looking for.
Finally, I had to look at the source files to understand what I should do.

Thanks in advance...
Ju

>
> (if not, follow up to c.l.python)
>
> cheers /F
>



More information about the Python-list mailing list