Access client IP from handler

235 Views Asked by At

i'm wondering, can I access the address of the client from a SocketServer.StreamRequestHandler (or more specifically, a subclass)? I didn't see any documentation on that.

Thanks!

1

There are 1 best solutions below

1
On BEST ANSWER

You're looking for RequestHandler.handle():

This function must do all the work required to service a request. The default implementation does nothing. Several instance attributes are available to it; the request is available as self.request; the client address as self.client_address; and the server instance as self.server, in case it needs access to per-server information.