[issue8498] Cannot use backlog = 0 for sockets

Jean-Paul Calderone report at bugs.python.org
Thu Apr 22 15:12:47 CEST 2010


Jean-Paul Calderone <exarkun at twistedmatrix.com> added the comment:

> Furthermore, python's socket documentation makes it clear:

Why does CPython go out of its way to make it impossible to pass 0 to the platform listen() API?  The part of the specification you quoted makes it very clear that 0 is a valid value for this argument.  And 0 seems to have a very different meaning than 1, but for some reason CPython thinks that 1 is a better thing for 0 to mean.

Perhaps there is a real reason someone thought to add this check in sock_listen, but if not, I think it's worth considering removing this check.

Unfortunately the commit message for the revision which added this check (r3880) is not informative:

sock_listen: ensure backlog argument is at least1

> If you really want to only accept 1 connection (I'm talking of sending back a SYN-ACK, not an accept() call), you can just close the server socket

This makes perfect sense, though, and is good advice in general.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8498>
_______________________________________


More information about the Python-bugs-list mailing list