lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Re: Knowing when TCP data has been sent


From: Kieran Mansley
Subject: Re: [lwip-users] Re: Knowing when TCP data has been sent
Date: Tue, 23 Mar 2010 13:15:16 +0000

On Tue, 2010-03-23 at 09:10 +0100, Sägesser Walter wrote:
> In the meantime I have encountered another strange thing which might belong to
> the same topic. The piece of SW I'm talking about works as a client in an 
> embedded device.
> If I delete a netconn after each 'netconn_write', I get out twice as many 
> packets as if 
> I let the netconn alive. This is independent of a callback and is also 
> contrary to what I
> would have expected. I thought building up a connection is more time 
> consuming than just
> writing to an existing one.

OK, the reason for the long time before the callback in your original
problem is probably that the other end is waiting for more than one
packet before it sends an ACK - the TCP delayed ACK algorithm.  After a
while (200ms) it times out and sends an ACK anyway, which means lwIP can
finish with your buffer and call the callback.

If you close the connection straight away lwIP will send a FIN to the
other end to tell it you're done.  This will get ACKed immediately
without waiting for more packets (there won't be any!) and so it goes a
bit quicker.

You said before that you could get 120 times better throughput by using
the COPY flag (which will result in proper streaming, albeit with a
copy).  This performance improvement somewhat dwarfs the 2 times speedup
you get from closing the connection, so your assumption that building up
a connection is time consuming is right.

Kieran





reply via email to

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