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


Groups > comp.lang.python > #38335

select.epoll question

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject select.epoll question
Date 2013-02-06 23:08 -0800
Organization Nightsong/Fort GNOX
Message-ID <7xbobw1tzr.fsf@ruckus.brouhaha.com> (permalink)

Show all headers | View raw


I'm trying to listen to a bunch of sockets using epoll under Linux, e.g.

   import select, socket
   socket1 = socket.socket() ...

   p = select.epoll()
   p.register(socket1); p.register(socket2); ...
   result = p.poll()

This returns `result' as a list of 2-tuples (fd, status) where fd
is a Linux file descriptor, i.e. a small integer like comes back 
from socket.fileno().  That's different from select.select, which
returns a list of actual socket objects that I can read from with
socket.recv().  

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?

The docs for epoll in select.html don't seem very good.  I haven't
yet examined the source code.

Thanks for any advice.

--Paul

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