How many connections can accept a 'binded' socket?
Laurent Pointal
laurent.pointal at limsi.fr
Tue Mar 20 09:25:06 EDT 2007
billiejoex a écrit :
> Hi,
> I'm writing a small asyncore-based server application serving a lot of
> clients. When I have to handle more than 1021 client simoultaneously
> the 'binded' socket object raises an error:
>
> [...]
> connections: 1018
> connections: 1019
> connections: 1020
> connections: 1021
> Traceback (most recent call last):
> File "asyncore_client.py", line 31, in <module>
> File "asyncore.py", line 191, in loop
> File "asyncore.py", line 138, in poll
> File "asyncore.py", line 80, in write
> File "asyncore.py", line 76, in write
> File "asyncore.py", line 395, in handle_write_event
> File "asyncore_client.py", line 24, in handle_connect
> File "asyncore_client.py", line 9, in __init__
> File "asyncore.py", line 257, in create_socket
> File "socket.py", line 156, in __init__
> socket.error: (24, 'Too many open files')
>
> I just wanna know: is there a way to know how many connections can
> accept a 'binded' socket BEFORE getting such error? Maybe
> socket.SOMAXCONN could help me?
Here you get out of file descriptors, I dont think SOMAXCONN would help.
Under Linux (maybe Unix), there is ulimit -n nnn to setup the maximum
number of files descriptors. I don't know its upper limit (maybe a
kernel compile time information).
More information about the Python-list
mailing list