lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] question about netconn_write


From: Kieran Mansley
Subject: Re: [lwip-users] question about netconn_write
Date: Sat, 13 Dec 2008 13:11:24 +0000

On Sat, 2008-12-13 at 20:20 +0800, yueyue papa wrote:
> Wether it comes out depend the task schedule, if the data is lost in
> the line, the netconn_write already returned.

Yes, but if it gets lost, TCP should retransmit it.  If you're using
UDP, and expecting all the data to get through, then that's a problem.
None of the lwIP APIs have a "send" function that waits until the data
has successfully crossed the network.

> If it is true, is the any API could i flush the data in the send
> buffer, force 
> the data send out, and make sure the data has been ACK by remote.

If you do something like this:
  netconn.pcb.tcp->flags |= TF_NODELAY;

then you will disable Nagle's algorithm, which is the most common reason
that writes are delayed and batched together for sending.  Note that
this might result in small transmissions which are inefficient if you're
about to queue some more data anyway.

However, it sounds like you were hoping that netconn_write() wouldn't
return until the data had been successfully received and acknowledged by
the other side.  That still won't be the case if you set TF_NODELAY.

If you were using the raw API you can call tcp_write() to queue the data
and tcp_output() to send it at times that are sensible for your
application.

Kieran





reply via email to

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