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


Groups > comp.lang.python > #58191

getpeername() on stdin?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <roy@panix.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'socket': 0.07; 'library?': 0.09; 'family,': 0.16; 'received:166.84': 0.16; 'received:166.84.1': 0.16; 'received:166.84.1.89': 0.16; 'received:24.136': 0.16; 'received:mailbackend.panix.com': 0.16; 'received:panix.com': 0.16; 'roy': 0.16; 'to:name:python list': 0.16; 'type)': 0.16; 'received:166': 0.19; '---': 0.24; 'received:24': 0.27; 'are.': 0.31; 'skip:s 30': 0.35; 'but': 0.35; 'done': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'header :Message-Id:1': 0.63; 'smith': 0.68; 'family': 0.73; 'discover': 0.82; 'email addr:panix.com': 0.84
From Roy Smith <roy@panix.com>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding quoted-printable
Date Thu, 31 Oct 2013 12:16:23 -0400
Subject getpeername() on stdin?
To Python List <python-list@python.org>
Mime-Version 1.0 (Apple Message framework v1283)
X-Mailer Apple Mail (2.1283)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1885.1383236191.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1383236192 news.xs4all.nl 15984 [2001:888:2000:d::a6]:40287
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:58191

Show key headers only | View raw


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@panix.com


Back to comp.lang.python | Previous | NextNext 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