Here's a great article on everything you'd ever want to know about handling half-open TCP connections:

http://www.codeproject.com/Articles/37490/Detection-of-Half-Open-Dropped-TCP-IP-Socket-Conne

I make sure to keep this book marked :D

Joel

On Feb 08, 2016, at 04:06 PM, Sylvain Rochet <[email protected]> wrote:

Hi Frédéric,

On Mon, Feb 08, 2016 at 12:52:43PM +0000, Frédéric Grandjean wrote:
Hi,
I'm using LWIP 1.4.1 and I'm facing an issue with "brutal" raw socket disconnection.

Imagine the following scenario:

- Create a TCP_PCB listener (server)

- On connection from a remote host (a Windows PC), accept it, with all callbacks

- Now, I remove the Ethernet cable from my application

- I also exit (brutally) the remote client application

- Now, I wait 1 minutes and connect back the Ethernet cable

- LWIP never signals the connection is lost, not the state of the PCB tells me (Still ESTABLISHED)!


How to detect this kind of disconnection ?

TCP keepalive is your friend here (LWIP_TCP_KEEPALIVE).

Other solutions usually chosen are server side timeout (e.g. HTTP) or an
application level ping/pong protocol (e.g. IRC).

Sylvain
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Attachment: signature.asc
Description: PGP signature

_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to