lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] peer hangs up without closing the connection


From: Robert Wessels
Subject: [lwip-users] peer hangs up without closing the connection
Date: Thu, 6 Feb 2014 10:44:07 -0800

Hello LwIP, 

I am working on an Ethernet library for Energia. Energia is an implementation 
of the Wiring/Arduino framework for the Texas Instruments Maker friendly 
development boards called LaunchPads.

I am done with the implementation and I am very impressed with LwIP’s stability 
and performance. There is however one thing that I would like some advice on. I 
am using LwIP in an NO_OS mode an use the RAW socket API.

Consider the following Scenario.
The client (my board) connects to a server. The client sends some data and 
expects the server to reply. The server proces for whatever reason crashes 
without properly closing the connection. So the client (my board) thinks the 
connection is still alive and waits for ever for data to arrive. I have 
simulated this with a local webserver on a PC that is connected to a switch. 
The board is connected to the same switch. When I pull the ethernet cable that 
is connected to the server (PC) the client (the board with LwIP) will sit there 
for ever waiting for data to arrive.

I have tried using the keep alive feature of LwIP but that does not quite do 
the trick. Timeout’s are to long and without modifying those I won’t be able to 
bend it to my needs.

What I am thinking of implementing is my own keep alive. When the client 
connects successfully I set the tcp_poll callback to be called every 5 seconds. 
In the poll callback I call tcp_keepalive() and increase pcb->keep_cnt_sent by 
one. I check pcb->keep_cnt_sent every time the poll callback is called. If 
pcb->keep_cnt_sent reaches a certain number then I consider the connection to 
be dead and shutdown the connection.

Does that sound reasonable? Would sending a keep alive probe every 5 seconds be 
considered abusive? Any other way to accomplish this?

Thanks,

Robert


reply via email to

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