Hi,
This is normal BSD semantics of a TCP listener, use SO_REUSEADDR before calling
bind to avoid the issue
Joel
> On Jun 8, 2017, at 4:18 PM, Ignacio García Pérez wrote:
>
> Hi All,
>
> I'm writing a simple FTP server that needs to be started up and shut down
> with relatively high frequency (say once per minute), so each time I must
> create the listening PCB, bind, listen, accept, etc. The problem is that when
> I close a client connection the PCB goes into the TIME-WAIT state and the
> next bind operation will fail with ERR_USE.
>
> Looking at the code I see that all TIME-WAIT PCB are kept in a list and this
> list is checked for the requested port in the tcp_bind() function.
>
> Of course eventually the PCB is purged (after 2 * TCP_MSL = 120s by default),
> but that does not solve the problem in my scenario (which I admit is
> somewhat exotic).
>
> Question:
>
> 1- Is this behaviour expected?
>
> 2- Is there any workaround?
>
> If the purpose of keeping the PCB in TIME-WAIT is to prevent new connections
> to/from the same host:port to be created, it doesn't make sense to check when
> calling tcp_bind(), it would make more sense to check calling tcp_connect()
> or when an incoming connection is initiated.
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users