lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] How do I control the numbers of TCP connection to the s


From: address@hidden
Subject: Re: [lwip-users] How do I control the numbers of TCP connection to the same port?
Date: Thu, 04 Feb 2010 16:47:05 +0100
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1

Bill Auerbach wrote:
This means tcp_listen_with_backlog can be used to enforce only one
connection?
Exactly. That's what the backlog parameter in posix listen() does, also.

If this backlog limit is exceeded, what happens?
Incoming connections will be sent a RST. However, this doesn't limit
concurrent connections by default: it has been introduced to limit the
outstanding-connection-queue for netconn- or socket-API. Normally, for
the raw API, there is no such thing (that lies in the nature of the
single-threaded callback mechanism). However, when using this feature,
you have to call tcp_accepted from your appect function to decrease this
counter. If you defer calling tcp_accepted and call it later, you can
implement a concurrent-connection limitation.

When using the socket- or netconn-API, the stack does this for you.
Suppose you have one thread calling accept/recv/send/close in a loop and
set the backlog to 1 then you will only have one active and one pending
connection at a time and all other SYNs coming in will be RST'ed.

Simon





reply via email to

[Prev in Thread] Current Thread [Next in Thread]