Newbie question: how to keep a socket listening?

Peter Hansen peter at engcorp.com
Fri Jun 24 21:21:34 EDT 2005


ncf wrote:
> Heh, like I said. I was not at all sure. :P
> 
> Nevertheless, could this be the problem? =\

You *may* correct, mainly because the OP's code doesn't appear to spawn 
off new threads to handle the client connections, which means he can 
handle only one connection at a time.  Specifically, while he is talking 
to one client he is not also in an accept() call on the server socket, 
which means there will be (because of the listen(1) call) only a single 
pending connection allowed in the backlog.

I haven't attempted a thorough analysis... just this much, trying to see 
whether it is obvious that the listen(1) is at fault -- and it's not 
obvious.  I thought this response might clarify the meaning of listen(1) 
a little bit for some folks nevertheless.

-Peter



More information about the Python-list mailing list