|
From: | Keith Rubow |
Subject: | [lwip-users] Problem re-opening listening pbc |
Date: | Wed, 9 May 2018 13:11:49 -0700 |
User-agent: | Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
However, the problem is when the connection I accepted is closed. My receive callback is called with p=NULL, so I then remove all the callbacks and close the active connection with tcp_close(). Then I re-open the listening pcb with tcp_new(), tcp_bind(), and tcp_listen(). HOWEVER, the tcp_bind() fails with ERR_USE, presumably because the pcb for the active connection is not fully closed yet, making the port still in use.
I found I can "fix" the problem by closing the active connection with tcp_abort() instead of tcp_close(), but this seems kind of wrong. If I knew when the pcb for the active connection was really fully closed, I could open the listening pcb then. But I don't see any way to tell when the close is finished. There is no callback for it, and I am not permitted to access the pcb after calling tcp_close().
So how can I re-open a listening pcb on the port after a connection is closed?
Keith Rubow
[Prev in Thread] | Current Thread | [Next in Thread] |