[Top][All Lists]

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

Re: [lwip-users] question about netconn_write

From: yueyue papa
Subject: Re: [lwip-users] question about netconn_write
Date: Sat, 13 Dec 2008 21:59:53 +0800

Based on your suggtion,
I tried to add a lwip_tcpflush(int s)
int lwip_tcpflush(int s)
  struct lwip_socket *sock;
  sock = get_socket(s);
  if (!sock)
    return -1;
  return tcp_output(sock->conn.pcb.tcp);
Will it force data flush ?
I will make test.
Thank you very much
On Sat, Dec 13, 2008 at 9:11 PM, Kieran Mansley <address@hidden> wrote:
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


lwip-users mailing list

reply via email to

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