Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58285
| From | random832@fastmail.us |
|---|---|
| References | <mailman.1885.1383236191.18130.python-list@python.org> <pan.2013.11.01.01.12.30.485000@nowhere.com> |
| Subject | Re: getpeername() on stdin? |
| Date | 2013-11-01 14:55 -0400 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1937.1383332149.18130.python-list@python.org> (permalink) |
On Thu, Oct 31, 2013, at 21:12, Nobody wrote: > 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. If it's possible to get this information with only the fd, then why does socket.fromfd require them?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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