[Python-Dev] [Python-checkins] r42185 - python/trunk/Lib/test/test_socket_ssl.py

"Martin v. Löwis" martin at v.loewis.de
Thu Jan 26 06:57:13 CET 2006


Neal Norwitz wrote:
> That's what I was thinking of.  I thought you had to be accept()ing
> prior to connect() working.  I thought listen() only sets the # of
> outstanding connections allowed (basically internal buffer).  But if
> the listen() is sufficient, I agree there is no race.

Actually, that's the whole point of listen(). Even if you initially do
accept() quickly, it might be that another connection request (SYN)
arrives between return of accept() and the next call to accept();
this is essentially the same as connection requests arriving before
the first accept() call.

The kernel will acknowledge the SYN packet immediately, and do that for
at most "number-of-backlog" incoming connections. Then, subsequent
accept() calls will immediately return.

Regards,
Martin


More information about the Python-Dev mailing list