lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LW IP - TCP instantaneous data transmission


From: anand arjunan
Subject: Re: [lwip-users] LW IP - TCP instantaneous data transmission
Date: Wed, 31 Aug 2016 18:38:14 +0530

Hi Dirk,

I agree, this function is called when the data is sent to the client. In my case this will be called only once when the buffer is full (8*1460 bytes) and the data is sent to the client. But, I am adding data to the buffer with tcp_write( ) with the increments of around 2 k bytes every few msec. I want the data to be transmitted as soon as I fill the buffer with each of these increments.

Thanks
Anand

On Wed, Aug 31, 2016 at 3:59 PM, Dirk Ziegelmeier <address@hidden> wrote:
Check out tcp_sent() callback, it is called after data was successfully sent to remote station.

http://www.nongnu.org/lwip/2_0_0/group__tcp__raw.html#ga1596332b93bb6249179f3b89f24bd808


Ciao
Dirk

--
Dirk Ziegelmeier * address@hidden * http://www.ziegelmeier.net

On Wed, Aug 31, 2016 at 11:17 AM, anand arjunan <address@hidden> wrote:
Hi,

I am using LWIP (Raw TCP mode) (in FreeRTOS) for handling http page requests, construct the web page and send the page to the client. I have set the TCP_SND_BUF as 8*TCP_MSS where TCP_MSS is 1460. There will be only one client / browser connecting to the system at a time.

In the receive call back function, I constructed the entire web page and used the tcp_write () (with TCP_WRITE_FLAG_COPY ) to send the data to LWIP buffer. Due to memory limitations, I have to reuse a buffer size of 2.5 K to construct the page before writing it to LWIP using tcp_write () as the actual page size to be sent to client is more than 14 K. I was thinking that as and when I call tcp_output () the data would be sent instantaneously to the client. But, I got to know that tcp_Output() does not work in the callback function and LWIP will start sending the packets automatically once the control is out of the callback function. 

Due to this limitation I slightly modified the design. I have made the actual LWIP receive callback to just set another (second) callback function so that the actual LWIP callback would return immediately (so that tcp_output( ) can work). The second callback would actually construct the page and would be invoked by http_poll function or some other timer.

Even this does not work. It still accumulates the data worth of of 8*1460 bytes fully and sends only that much to the client. Once the buffer is full, tcp_sndbuf(pcb) returns zero and I cannot write anymore to it. I thought this would return non zero value as I am calling tcp_output ( ) outside the LWIP calling function using a timer function.

I tried disabling the nagle's algorithm using tcp_nagle_disbale( ) before transmitting the packets. That did not help either. 

I want the data to be sent to the client (without accumulating) as and when I call tcp_output( ) because of the limitation that I can construct only 2.5 K bytes of page at a time and reuse it to construct the next section of the page.

Please help. Any help / pointers would be appreciated.

Thanks
LWIP_Starter

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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