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


Groups > comp.lang.python > #38347

Re: select.epoll question

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'socket': 0.05; 'subject:question': 0.08; 'descriptor': 0.09; 'sockets': 0.09; 'skip:f 30': 0.15; 'descriptors': 0.16; 'directly?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'objects?': 0.16; 'sock': 0.16; 'wrote:': 0.17; 'any,': 0.17; 'thu,': 0.17; 'feb': 0.19; 'idea': 0.24; 'paul': 0.24; 'header:In- Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'interface': 0.27; 'though.': 0.29; 'file': 0.32; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'build': 0.39; 'your': 0.60; 'map': 0.61; 'kind': 0.61; 'back': 0.62; '2013': 0.84; 'about,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=hYh0/GgFvJUqzcSxBGJST57ocIgqSUbN32m6aqK7SVw=; b=h9SxxxVFxTqTP1u7vluLbSOgaoPazBDSAhiYW6ei4HuaOP0uNZLb9HytIj4vVVSdMH zojtcTUKu1dGdCMtr+6lbbfCOAdx4kLrWxZyDIFsrkm2jU3avDumk9Y1rt8k0ND6+tro ewXitcDCDaL6sWeh6wfgnUALBDHY4qg4d0lvkALuJ/Ww42pKFMh1d+uf2FvEcwIwAHwv zN3s0ib0gi3IxAlNnk1Xqru2FSC03mZyMJBcqLySGhwSyBaq/J+YcgvyEOvTw6rcH64U bg2OzronruvBvoD5QERqkIVLDWEX4qXPduIR3VHetPdEaClXalO7eJulDpyAxQXAPMpH n31Q==
MIME-Version 1.0
X-Received by 10.58.134.14 with SMTP id pg14mr1395785veb.42.1360241340224; Thu, 07 Feb 2013 04:49:00 -0800 (PST)
In-Reply-To <7xbobw1tzr.fsf@ruckus.brouhaha.com>
References <7xbobw1tzr.fsf@ruckus.brouhaha.com>
Date Thu, 7 Feb 2013 23:49:00 +1100
Subject Re: select.epoll question
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1447.1360241349.2939.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360241349 news.xs4all.nl 6942 [2001:888:2000:d::a6]:35482
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38347

Show key headers only | View raw


On Thu, Feb 7, 2013 at 6:08 PM, Paul Rubin <no.email@nospam.invalid> wrote:
> Any idea of a good way to map the file descriptors back to socket
> objects?  Is there some kind of hidden interface that I don't know
> about, that gives back sockets directly?

I don't know of any, but you can get the file descriptor from a socket
via fileno(), and build your own dictionary:

fd_to_sock={sock.fileno():sock for sock in list_of_sockets}

You'd need to manually maintain that as sockets get created/destroyed, though.

ChrisA

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


Thread

select.epoll question Paul Rubin <no.email@nospam.invalid> - 2013-02-06 23:08 -0800
  Re: select.epoll question Chris Angelico <rosuav@gmail.com> - 2013-02-07 23:49 +1100
    Re: select.epoll question Paul Rubin <no.email@nospam.invalid> - 2013-02-07 08:15 -0800
      Re: select.epoll question Chris Angelico <rosuav@gmail.com> - 2013-02-08 03:24 +1100
        Re: select.epoll question Paul Rubin <no.email@nospam.invalid> - 2013-02-07 12:19 -0800
          Re: select.epoll question Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-02-08 07:36 +0530

csiph-web