Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

ESP8266Webserver unable to send large amount of data (html)

Open rvbcrs opened this issue 11 years ago • 5 comments

Hi, I have the problem that I try to send a nice looking html page with _currentClient.print(response); but html is always getting capped at 2,876 bytes. Is there a way to send the whole page in chuncks? or another way to send the whole page? Anyone who can provide me with an example? Or alter the webserver code in a way it will accept a larger amount of data?

Thanks!

rvbcrs avatar May 13 '15 23:05 rvbcrs

8c1a40b2 hopefully fixes this: server.sendContent(string); knows how to split the payload into chunks and send them one by one.

igrr avatar May 14 '15 12:05 igrr

Hi, thanks for your response! I downloaded the latests source and comiled my project again. It seems to work but when I connect to the ESP8266 I now see nothing anymore! In chrome in developer tools I get this message: (failed)net::ERR_EMPTY_RESPONSE

this is my current code:

Serial.println("*** START HTML ***");
Serial.println(homePage);
Serial.println("*** END HTML ***");
server.send(200, "text/html", homePage);

i see the complete HTML displayed in the serial console, but nothing in the browser! Any advise?

UPDATE: It seems to be working correctly for "text/plain" and for "text/html" asl long as the html is not to big, I tried it with a fairly small html string and it was working perfectly!

rvbcrs avatar May 15 '15 09:05 rvbcrs

This could be problem of the stack - if you have a lot of Strings in the sketch, the stack is full.

robertgregor avatar May 15 '15 12:05 robertgregor

Hmm I'm pretty new to all this! Can you tell me what to do to prevent this? Use F() around the string? Or use PROGMEM? I thoughtI read somewhere that it was not working..

Thanks!

rvbcrs avatar May 15 '15 12:05 rvbcrs

Got it working! I've replaced all my files again with a freshly downloaded one from yesterday, put my string inside F() and now it works perfectly and fast!

rvbcrs avatar May 16 '15 08:05 rvbcrs