|
From: | address@hidden |
Subject: | Re: [lwip-users] Problem re-opening listening pbc |
Date: | Mon, 14 May 2018 20:56:25 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 14.05.2018 18:27, Keith Rubow wrote:
[..] I would like to have additional connection attempts to be refused. I can achieve this behavior only by closing the listening pcb once I reach the max number of connections, but then I can't re-open the listening pcb until ALL open connections are closed. But some connections might stay open indefinitely, in which case I can never open the listening pcb again.
You don't seem to read the responses to your mails. There were two suggestsions: a) do it the standard socket way (even if you are using lwIP callback API) and use REUSEADDR to be able to open the listening socket although connection sockets are active (or in time-wait; this *is* standard behaviour, not an lwIP thing!)
b) play with backlog.The default usage of backlog is to decrease it when connections are actually accepted, but you can just use it to only accept new connections after previous connections are closed. To do that, call 'tcp_backlog_delayed()' in your accept callback and call 'tcp_backlog_accepted()' when the pcb is closed (when the 'err' callback is called, the latter is done internally by the stack).
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |