HTML files > 2kB not served


#1

We use the W5100s chip in our design. I implemented the ioLibrary DHCP and HTTP server, both modules work fine, except that if I make my HTML page > 2kB, it seems that only the first 2kB of the page are sent to the client (browser), so I got to see half a web page.

I put debug logging at the lowest level, WIZCHIP_WRITE_BUF() and from there the library says it sends the first 2047 bytes and the second 2047 bytes and then the remaining 294 bytes, however the last 2 parts are not put on the ethernet bus at all. To avoid a TX buffer overrun, the http_server module is called every 200ms. Any idea why the remaining data is not sent?


#2

My educated guess is that you have some issue with TX buffer management, which, by default, is 2K in size. Impossible to say anything without related portions of code.


#3

Yes, I know the default buffer size is 2kB, I see the first 2kB being sent correctly, so the buffer size should not be an issue. I didn’t change ioLibrary in its functionality, I just configured the way of interfacing to the chip, set up an HTML page and let ioLibrary send it on request of the client. What part of the code are you interested in?


#4

Hi, Daan.

The HTTP server included in the ioLibrary is implemented to transmit the web component (including HTML file) to the client while performing the following functions sequentially for the HTTP request.

For example, If a index.html web page is requested,
(The httpServer_run () function should be called repeatedly in the loop.)

  1. Parses the HTTP request and checks whether the requested content exists.
  2. Create and send an HTTP response header. This includes the length of the content to be sent. (send_http_response_header () function)
  3. Send an HTTP response body. (send_http_response_body () function) At this time, if the size of web content is larger than DATA_BUF_SIZE (2048 bytes), the status of HTTP socket status is maintained as STATE_HTTP_RES_INPROC and the remaining data is repeatedly transmitted.
  4. If the HTTP client performs data transmission as much as file_len and then successfully terminates, the HTTP socket status changes to STATE_HTTP_IDLE.

The situation you’re referring to is that the send_http_response_body () function is not called repeatedly, or there seems to be a problem with the file length or HTTPSock_Status [get_seqnum] .file_len / offset handling.

Please check out these troubleshooting tips I mentioned.

Regards,
Eric


#5

Thank you Eric. I didn’t call reg_httpServer_webContent() correctly. Now it works great