lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] TCP KeepAlive


From: Martin Persich
Subject: Re: [lwip-users] TCP KeepAlive
Date: Tue, 21 Sep 2010 11:48:58 +0200

Hi, there is a quite old Atmel's bug (aprox one year ago was discussed in LwIP forum) . Both the timers (slow, fast) are started from the wrong task and dont work anyway. Please upgrade to last version of LwIP (1.4.0) and Atmel AVR32 library V 1.7. I had the same problems with old version. I'm using LwIP 1.3.2 with many, many updates from CVS (nearly version 1.4.0) and my "LwIP V 1.4.0 - ready" adapted port file "sys_arch.c" on AVR32 MCU (IAR EWAVR32 compiler) without problems.
Best Regards
Martin Persich
 
----- Original Message -----
Sent: Tuesday, September 21, 2010 1:37 AM
Subject: Re: [lwip-users] TCP KeepAlive

Upon accepting a client connection, I set the following socket options:
 
- SOF_KEEPALIVE
- TCP_KEEPIDLE

- TCP_KEEPINTVL

- TCP_KEEPCNT

 

I have also set LWIP_TCP_KEEPALIVE =  1 and have verified that lwip_setsockopt_internal is populating the appropriate registers. What puzzles me is that neither slow or fast timer are firing which is where KeepAlive action is detected and performed !

 

I am using lwIP 1.3.0 which is what AVR32 Studio had shipped. 

 

Thanx,

-FM




From: Jeff Barber <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Sent: Mon, September 20, 2010 2:38:21 PM
Subject: Re: [lwip-users] TCP KeepAlive

On Mon, Sep 20, 2010 at 10:07 AM, farid mahini <address@hidden> wrote:
> I am trying to enable KeepAlive/Idle feature, but I do not see a hit on
> tcp_tmr, tcp_slowtmr, tcp_fasttmr on an established connection!  I am using
> lwIP 1.3 with FreeRTOS. I do not see the KeepAlive variables being accessed
> anywhere else. Any ideas on what I may have overlooked?

I am using keepalives and they do work.  I'm using lwip version 1.3.2.
Here are a few notes that may help.

The keepalive packet is sent in tcp_slowtmr when appropriate (assuming
the SOF_KEEPALIVE flag is set).  The eventual timeout is also
determined by that function when the limit of keepalives to be sent is
reached.  The per-session tick counter is set to the current global
tick counter value in tcp_process whenever a packet is received on a
given session, and the keep_alive_sent count is reset to zero at the
same time.

I found the documentation for the keepalive variables to be a bit
unclear.  Bottom line is that (by default) the first keepalive is sent
when there has been no activity on the session for
TCP_KEEPIDLE_DEFAULT milliseconds, then a new keepalive is sent every
TCP_KEEPINTVL_DEFAULT milliseconds until a total of
TCP_KEEPCNT_DEFAULT probes have been sent.  At that point, the session
is closed.

The default settings are such that the first keepalive is not sent
until two hours of inactivity, then 9 keepalives are sent spaced 75
seconds apart.  These were much too large for what I wanted: I have a
backplane ethernet between two closely-coupled systems and need to
detect loss of peer relatively quickly.  I reduced them to 10 seconds
for the first keepalive, then 9 more probes sent two seconds apart.
(This is also *much* easier to test since you don't have to wait
around for two+ hours to see your session timeout. :-)

Note that the setsockopts API also lets you set the values of these,
but in that case they are specified in seconds, not milliseconds.

Jeff

_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

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