Search code examples
pythonsocketssocket.ioraspberry-piserversocket

Access parameter of socket connection object


Im trying to access the object parameter of the client socket. But I don't know how to access it. here is the code

server.listen(1)
clientsock, ClientAddress = server.accept()
print(clientsock)
clientsock[0]  #error

here is my error and results. I want access these (the highlighted parameters)

Can somebody help me to find the solution because I didn't find it yet.


Solution

  • If you look at the documentation for socket objects you'll see that you can access the family, type, and proto member variables for the object, along with the fileno() member function.

    The documentation is always the first place to look.