lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Half-Open detecting


From: Stephen Cleary
Subject: Re: [lwip-users] Half-Open detecting
Date: Thu, 21 Apr 2011 12:48:38 +0000

> As a TCP server, I want to detect half-open state that may fall in
> either of the following cases:
> 
> 1. Established connection broken somehow, but the peer still send
> segments to me, in this case, there will not be a pcb on my side
> matches.
> 2. Peer crashed somehow, but I still in 'established' state, then the
> peer send a SYN to me. In this case, still no a connection on my side
> could match.

I don't believe lwIP supports keepalives, though I may be wrong.

The normal way to detect a half-open connection is to send data at regular 
intervals; an lwIP or OS timer would help with this approach (i.e., send a noop 
message if you haven't written to the socket for some period of time).

An alternative solution is to keep listening all the time, and abort the 
existing connection when a new one arrives. This assumes that your design is 
for a single client.

You do need to handle this on both sides. I am writing for a similar design 
(single PC client connecting to a lwIP server), and I'm using the timer 
solution on the PC side and the abort-on-new-connection solution on the lwIP 
side.

       -Steve


reply via email to

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