ulimit on open sockets ?

Maxim Veksler hq4ever at gmail.com
Thu Apr 12 16:17:07 EDT 2007


On 4/10/07, Alex Martelli <aleax at mac.com> wrote:
> Maxim Veksler <hq4ever at gmail.com> wrote:
>
> > ValueError: filedescriptor out of range in select()
> > """
> >
> > Should I be using a different version of select or something? Or
>
> select typically supports 1024 FDs at most (a design limit of the
> underlying operating system).  You may want to try poll instead (epoll
> might be better but I doubt Python supports it yet).
>

I've read some post the other day of a guy faced similar problem and
it turns out {e,}poll is limited as well, besides I don't know how to
use it so an example would be great.

Now, someone I work with suggested a simple work around "Pass the list
objects in groups of 1024 each time to the select.select structure". I
think it's acceptable and good advice, the thing is I don't know how
to implement this "the python way" (that is - with out it being ugly).

Can I do modulation ( % 1024 ) on the main iterator loop?
Something like:

 for nb_active_socket in (all_sockets % 1024):
       if nb_active_socket in ready_to_read:
           conn, addr = nb_active_socket.accept()
           while 1:
               data = conn.recv(1024)
               if not data: break
               conn.send(data)
           conn.close()

?

Thanks for helping,
Maxim.

>
> Alex
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Cheers,
Maxim Veksler

"Free as in Freedom" - Do u GNU ?



More information about the Python-list mailing list