Newbie question: how to keep a socket listening?
Grant Edwards
grante at visi.com
Fri Jun 24 21:28:41 EDT 2005
On 2005-06-25, Peter Hansen <peter at engcorp.com> wrote:
> 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.
But when he closes that connection, he calls accept again. And
it's at that point where he tries to connect and can't. I
think.
Can the program be pared down to something smaller that
demonstrates the problem?
> 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.
He could change the 1 to a larger number and see if the
behavior changes.
--
Grant Edwards grante Yow! I was giving HAIR
at CUTS to th' SAUCER PEOPLE
visi.com ... I'm CLEAN!!
More information about the Python-list
mailing list