Re: select.epoll question

2013-02-07 Thread Kushal Kumaran
Paul Rubin writes: > Chris Angelico writes: >> Yeah, I figured fileno() probably wouldn't be news to you. I don't >> suppose there's anything convenient in the rest of your application >> that makes such a list/dict plausible? > > In fact it's rather annoying, sockets are created and destroyed

Re: select.epoll question

2013-02-07 Thread Paul Rubin
Chris Angelico writes: > Yeah, I figured fileno() probably wouldn't be news to you. I don't > suppose there's anything convenient in the rest of your application > that makes such a list/dict plausible? In fact it's rather annoying, sockets are created and destroyed in multiple places in the pro

Re: select.epoll question

2013-02-07 Thread Chris Angelico
On Fri, Feb 8, 2013 at 3:15 AM, Paul Rubin wrote: > Chris Angelico writes: >> 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 > > Thanks, I was hoping to avoid that. I'll have to check how > select.se

Re: select.epoll question

2013-02-07 Thread Paul Rubin
Chris Angelico writes: > 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 Thanks, I was hoping to avoid that. I'll have to check how select.select manages to return sockets. Maybe it builds such a dict

Re: select.epoll question

2013-02-07 Thread Chris Angelico
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 soc

select.epoll question

2013-02-06 Thread Paul Rubin
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 Li