|
From: | anand arjunan |
Subject: | Re: [lwip-users] LW IP - TCP instantaneous data transmission |
Date: | Wed, 31 Aug 2016 18:50:20 +0530 |
Calling tcp_output() sends the data, but that doesn't mean the buffer is free afterwards: it stays allocated until the remote host acknowledges it. At this point, lwip calls your 'sent' callback.
Simon
Gesendet mit AquaMail für Android
http://www.aqua-mail.comAm 31. August 2016 12:22:08 nachm. schrieb anand arjunan <address@hidden>:
______________________________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.ThanksLWIP_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
[Prev in Thread] | Current Thread | [Next in Thread] |