Search code examples
pythonsocketssocketserver

How can I get a client's Name attribute with SocketServer in python?


I'm using a class RequestHandler(SocketServer.BaseRequestHandler)to handle incoming connections to a server.

I am trying to get the name of the client which is stored as an attribute that sends data to this server, but right now I can only get it by asking for self.client_address which returns a tuple like Name of client that sent request: ('127.0.0.1', 57547).

Is there a way to ask for an attribute of the object that initiated the connection?


Solution

  • No. You would have to send that name over the communication channel.