Newbie question: how to keep a socket listening?

Grant Edwards grante at visi.com
Sat Jun 25 03:38:37 CEST 2005


On 2005-06-25, Jp Calderone <exarkun at divmod.com> wrote:

> The argument to listen() is only a _hint_ to the TCP/IP stack.
> Linux, at least, will not create a buffer large enough for
> only a single connection.  You can test this easily: create a
> socket, bind it to an address, call listen(1) on it, and
> *don't* call accept().  Telnet (or connect somehow)
> repeatedly, until your connection is not accepted.  On my
> system (Linux 2.6.10), I can connect successfully 8 times
> before the behavior changes.

I had noticed that once upon a time.  I had forgotten that 8
was the minimum, but I do remember that 1 didn't result in a
second connect failing.

-- 
Grant Edwards                   grante             Yow!  Ha ha  Ha ha Ha ha
                                  at               Ha Ha Ha Ha -- When will I
                               visi.com            EVER stop HAVING FUN?!!



More information about the Python-list mailing list