lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] TCP_WRITE_FLAG_MORE, tcp_write(), tcp_output() and real


From: Giuseppe Modugno
Subject: Re: [lwip-users] TCP_WRITE_FLAG_MORE, tcp_write(), tcp_output() and real output TCP segment
Date: Thu, 23 Nov 2017 16:25:47 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Il 22/11/2017 17:09, address@hidden ha scritto:
Giuseppe Modugno wrote:

I'm sorry for the second email.

I noticed in tcp_output():

  /* First, check if we are invoked by the TCP input processing
     code. If so, we do not output anything. Instead, we rely on the
     input processing code to call us when input processing is done
     with. */
  if (tcp_input_pcb == pcb) {
    return ERR_OK;
  }

In the application recv() function, I decide I received all data and now I'm ready to answer with a reply. I call tcp_write() (maybe multiple times) from recv() and then tcp_output(). The previous if has the effect to return immediately from tcp_output(), so its call is useless.


It is, in this case. But normally, it's better to keep it in there instead of making your 'send-more'-code know if it is called from 'recv' or 'poll' or 'sent' callback...
For example, httpd usually calls tcp_output() after http_send(), except when http_send() is called from http_recv(). From what you write, it's better to call tcp_output() even in http_recv().

reply via email to

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