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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Thu, Feb 7, 2013 at 6:08 PM, Paul Rubin 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