Hi Noam, This is an existing implementation and cannot move to other implementation right away. I am adding new features to it with a memory constraint. :-( So far the page size was small and the entire page was buffered in the memory and sent at one shot once the call back function is out. Now, I don't have the luxury of huge memory and hence have to construct the page in sections and send them to client as and when they are constructed.
Thanks Anand On Wed, Aug 31, 2016 at 3:58 PM, Noam Weissman <n...@silrd.com> wrote: > Hi, > > > > Before you start re-inventing the wheel why not take a readymade HTTP > server ? > > > > You have a basic good HTTP server in the lwIP contribution or similar that > runs in RAW API. > > > > BR, > > Noam. > > > > *From:* lwip-users [mailto:lwip-users-bounces+noam=silrd....@nongnu.org] *On > Behalf Of *anand arjunan > *Sent:* Wednesday, August 31, 2016 12:18 PM > *To:* lwip-users@nongnu.org > *Subject:* [lwip-users] LW IP - TCP instantaneous data transmission > > > > 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 > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users >
_______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users