[Top][All Lists]

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

Re: [lwip-users] Re: lwip connect to normal socket application very very

From: Kieran Mansley
Subject: Re: [lwip-users] Re: lwip connect to normal socket application very very slowly
Date: Tue, 05 Sep 2006 09:58:24 +0100

On Tue, 2006-09-05 at 11:31 +0800, address@hidden wrote:

> I have found out the problem..... 
> linux socket program will use NAGLE/delayed ACK...algorithm. 
> If I use "tcp_write();tcp_output();" to send a packet(1024 bytes ) to
> the linux socket prgram!! 
> it will reply me a ACK after 0.1~0.2 sec, it is too long!! 
> Even if I set URG,PSH tcp flags inside the packet, it is the same !! 
> linux socket program will insist on replying me ACK after after
> 0.1~0.2 sec! 
> and inner LWIP seems to insist on receiving ACK (belong to previous
> packet) and then send next packet!! 
> Why I said it is very very slowly..... 
> If I use two linux socket program to communicate with each other!!! 
> They will send two packets (1024 bytes), and wait only one ACK, just
> after 0.0001~0.0002 sec. 
> Could anybody know how can I push the other side (linux socket
> program) reply me more quickly? 

The most simple approach would be to disable the Nagle algorithm on the
other side.

However, this should not really be necessary.  I assume that you want
the ACK to be sent back quickly so you can send more data.  The reason
the data can't be sent until the ACK is received is TCP's flow control
algorithm.  However, this algorithm adapts how much data it will have
in-flight (i.e. how much it can send without receiving an ACK), so it
will eventually (after a few round trip times) be able to saturate the
link.  If you want to read up on this there are plenty of descriptions
on the Internet.

If your application is sending data in a pattern that prevents this from
happening, then you will either have to make do with the lower bandwidth
(if it's not streaming data, then bandwidth is probably not a big deal
anyway) or perhaps use UDP instead.

I think linux has a special "fast start" mode of operation in which it
ACKs every packet at times when it thinks it would be a good idea to do
so, which is why you might see good performance between two linux hosts.
lwIP tries to be simple and lightweight, so this isn't the sort of
extension that would normally be included.

Hope that helps,


reply via email to

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