lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] tcp_output does not force seg sent out


From: narke
Subject: Re: [lwip-devel] tcp_output does not force seg sent out
Date: Sat, 10 Mar 2012 15:03:51 +0800

On 9 March 2012 15:50, narke <address@hidden> wrote:
> On 9 March 2012 15:08, Simon Goldschmidt <address@hidden> wrote:
>> narke <address@hidden> wrote:
>>> I found it's not always that the tcp_output() call can make a segment
>>> to be sent out.   Sometimes it still accumulated data until TCP_MSS
>>> reached before output a segment.
>>
>> That's the nagle algorithm (-> google). In short, it tries to limit the 
>> overhead of ACK segments by sending as little segments as possible by 
>> combining multiple calls to write() into a single segment.
>>
>>> In what situation that tcp_output()
>>> does not output segment?
>>
>> A segment is sent tcp_do_output_nagle() results in 1:
>>
>> #define tcp_do_output_nagle(tpcb) ((((tpcb)->unacked == NULL) || \
>>                            ((tpcb)->flags & (TF_NODELAY | TF_INFR)) || \
>>                            (((tpcb)->unsent != NULL) && 
>> (((tpcb)->unsent->next != NULL) || \
>>                              ((tpcb)->unsent->len >= (tpcb)->mss))) || \
>>                            ((tcp_sndbuf(tpcb) == 0) || 
>> (tcp_sndqueuelen(tpcb) >= TCP_SND_QUEUELEN)) \
>>                            ) ? 1 : 0)
>>
>> In other words, if there is unacked data, we wait for it to be acked or to 
>> send a full segment (unless we are in fast retransmit or ran out of lwIP 
>> buffers).
>>
>>> And, how do I ensure the output behavior
>>> really happen?
>>
>> Call tcp_nagle_enable(pcb).
>>

Simon,

Are you sure it's tcp_nagle_enable(pcb) and not
tcp_nagle_disable(pcb)?   From code and the naming, I think to I
should set the TCP_NODELAY in order to by pass the nagle algorightm.
Can you double check that?



reply via email to

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