On Thu, 31 Oct 2013 12:16:23 -0400, Roy Smith wrote: > 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?
I think that you'd need to use ctypes to access the underlying getpeername() function from libc. -- https://mail.python.org/mailman/listinfo/python-list