On Fri, Feb 8, 2013 at 3:15 AM, Paul Rubin <no.email@nospam.invalid> wrote:
> Chris Angelico <ros...@gmail.com> 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
> from the object list before it calls the system's select function, then
> maps the result  back afterwards.  Ugh.

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? For instance, if you need to
maintain a list of all current socket connections to support broadcast
operations, then it's not much harder to also maintain the fd->socket
mapping.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to