lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Bind fails after previous server-initiated connection close


From: Ignacio García Pérez
Subject: [lwip-users] Bind fails after previous server-initiated connection close
Date: Thu, 8 Jun 2017 23:18:38 +0200

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.

reply via email to

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