getpeername() on stdin?

Roy Smith roy at panix.com
Thu Oct 31 12:16:23 EDT 2013


I want to do getpeername() on stdin.  I know I can do this by wrapping a socket object around stdin, with

s = socket.fromfd(sys.stdin.fileno(), family, type)

but that requires that I know what the family and type are.   What I want to do is discover the family and type by looking at what getpeername() and/or getsockname() return.  Can this be done with the standard library?

---
Roy Smith
roy at panix.com






More information about the Python-list mailing list