[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Send out TCP packet asap?
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] Send out TCP packet asap? |
Date: |
Thu, 26 Jul 2012 07:36:23 +0200 |
Chen <address@hidden> wrote:
> I use lwip_send (....0), along with FreeRTOS on AVR32, to send out TCP
> packets
>
> Each time I call, I present 200 bytes to lwip. From Wireshark, I can
> see the packets size alternating between 200 and 1400 bytes with more
> idle time right before the 1400-byte packet
>
> Is there a flag I can set so that lwip sends out the packet (200
> bytes) if the output queque is empty, without trying to packaging the
> data to make it more efficient?
It is efficient as it is, as it uses less header bytes per data byte when
combining multiple 200-byte-chunks into one 1400-byte-packet. Note that this is
only done when there is un-ACKed data - this is the TCP representation of your
"output queue is empty". Note that when using sockets, the actual output queue
is always empty as tcp_output() is called after each send().
What you want is less latency, I guess (i.e. sending the packets right away
without combining them)? This can be achieved by disabling the nagle algorithm,
which can be done like this on most socket implementations:
int flag = 1;
ret = setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag) );
Simon