lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] RE: [lwip] Newbie TCP problem


From: Andy Knox
Subject: [lwip-users] RE: [lwip] Newbie TCP problem
Date: Wed, 08 Jan 2003 23:23:42 -0000

Hi Adam,

> This problem is because lwIP does not respond to TCP "keep-alives" as it
> should.
>  <snip>
> The solution is to add the following code to the end of tcp_input.c (the
> tcp_receive() function):
>
>   } else {
>     /* Segments with length 0 is taken care of here. Segments that
>        fall out of the window are ACKed. */
>     if(TCP_SEQ_GT(pcb->rcv_nxt, seqno) ||
>        TCP_SEQ_GEQ(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {
>       tcp_ack_now(pcb);
>     }

Thanks very much for the suggestion. Unfortunately it doesn't seem to have
the desired effect.
lwip now does ACK the empty segment from Linux but this doesn't seem to
prompt Linux to send any more data packets.

I have noticed that after the final data segment is sent from Linux lwip
immediately responds with an ACK (as you would expect). However, there is
then a pause of a couple of seconds before Linux sends out it's first
Keep-Alive message. lwip does then immediately ACK each of the Keep-Alive
messages but Linux just keeps sending them at increasing intervals as
before.

I am puzzled as to why Linux should send out any Keep-Alive messages. I have
checked the SO_KEEPALIVE socket option on the socket that I'm using and the
value is 0, presumably meaning that the KEEPALIVE option is turned off. Even
if it were on, I would have thought that the first message should not be
sent for a couple of hours (the tcp_keepalive_time sysctl is set to 7200
seconds).

Do you know of any other circumstances that can cause the sender to send an
empty segment with an ACK sequence number 1 less than the expected value?

I updated to lwip 0.5.0 before adding the code that you suggested but
obviously this hasn't helped either. In fact it has introduced another
problem: If I write small packets of 128 bytes into the socket, with a 1
second gap between them, Linux sends these out immediately with the
segment's PSH flag set. lwip never ACKs these packets so Linux just resends
the first segment over and over. This did not happen with 0.4.1 - each
segment was ACK'd properly.

I am using the following defines:
#define TCP_MSS                 512
#define TCP_SND_BUF             1024
#define TCP_WND                 2048

Thanks,
- Andy

[This message was sent through the lwip discussion list.]




reply via email to

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