-->
Page 1 of 1

using send_P for webpage in Progrgam memory

PostPosted: Tue Aug 09, 2022 4:30 am
by rascalsailor
I am doing a webserver using the code at: https://circuitdigest.com/microcontroller-projects/ajax-with-esp8266-dynamic-web-page-update-without-reloading
The esp8266 keeps resetting and that seems to be an issue with storage in Program memory causing a corruption to the main code.
I read the post at https://www.esp8266.com/viewtopic.php?p=48388 But there it uses server.send(...) as my code from the example is doing.
As I understand it, I need to use:
Code: Select allserver.send_P(200, "text/html", s );

rather than:
Code: Select allserver.send(200, "text/html", s );

I'm getting an error saying that send_P expects 4 arguments.
Can anyone advise how to correctly send a page from prog memory?
thanks
Russell

Re: using send_P for webpage in Progrgam memory

PostPosted: Sat Aug 13, 2022 11:30 pm
by rooppoorali
From here: https://links2004.github.io/Arduino/d3/ ... erver.html
it looks like there are two types of send_P function.

void send_P (int code, PGM_P content_type, PGM_P content)

void send_P (int code, PGM_P content_type, PGM_P content, size_t contentLength)

You may have you specify the text's length in the forth parameter.