Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #58222

Re: getpeername() on stdin?

From Nobody <nobody@nowhere.com>
Subject Re: getpeername() on stdin?
Date 2013-11-01 01:12 +0000
Message-Id <pan.2013.11.01.01.12.30.485000@nowhere.com>
Newsgroups comp.lang.python
References <mailman.1885.1383236191.18130.python-list@python.org>
Organization Zen Internet

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

getpeername() on stdin? Roy Smith <roy@panix.com> - 2013-10-31 12:16 -0400
  Re: getpeername() on stdin? Nobody <nobody@nowhere.com> - 2013-11-01 01:12 +0000
    Re: getpeername() on stdin? random832@fastmail.us - 2013-11-01 14:55 -0400
      Re: getpeername() on stdin? Roy Smith <roy@panix.com> - 2013-11-01 20:26 -0400
      Re: getpeername() on stdin? Nobody <nobody@nowhere.com> - 2013-11-03 03:27 +0000

csiph-web