Re: lwip-users Digest, Vol 107, Issue 32

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: lwip-users Digest, Vol 107, Issue 32

Xun Chen
Simon, thanks for your reply.

is
setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag) ) the same as tcp_nagle_disable(myconn-> pcb.tcp )?

I already have
tcp_nagle_disable(myconn-> pcb. tcp) in my codes when I observed packets size alternating between 200 and 1400 bytes


Chen <[hidden email]> 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

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: lwip-users Digest, Vol 107, Issue 32

Kieran Mansley
On Thu, 2012-07-26 at 09:04 -0400, Chen wrote:
> Simon, thanks for your reply.
>
> is setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
> sizeof(flag) ) the same as tcp_nagle_disable(myconn->pcb.tcp)?
>
> I already have tcp_nagle_disable(myconn->pcb.tcp) in my codes when I
> observed packets size alternating between 200 and 1400 bytes

Yes, they should be the same.  A packet capture might show something
interesting.

Kieran


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users