client.print() / HTML problems
Posted: Sun Jan 17, 2016 12:33 pm
My current sketch is working , but occasionally client stops communicating...
I am using similar Header,page,footer pages..that my NodeMCU [working fine] is using...
I noticed the header did not contain then following "HTTP/1.1 200 OK\r\n";
If I add this to the header I get no display.....
code is below... I was moving code to new sketch for diagnosing and encounter a new wrinkle...
and I cannot get multiple client.print(X); to work. with or without "HTTP/1.1 200 OK\r\n";
The 1st client.print shows nothing, the 2nd client.print - displays the code on the page ..
I have no clue what is happening.... This symptom is very similar to the problem in nodemcu
dealing with call backs .......I'm apparently doing something wrong but don't know what....
I am using similar Header,page,footer pages..that my NodeMCU [working fine] is using...
I noticed the header did not contain then following "HTTP/1.1 200 OK\r\n";
If I add this to the header I get no display.....
code is below... I was moving code to new sketch for diagnosing and encounter a new wrinkle...
and I cannot get multiple client.print(X); to work. with or without "HTTP/1.1 200 OK\r\n";
The 1st client.print shows nothing, the 2nd client.print - displays the code on the page ..
I have no clue what is happening.... This symptom is very similar to the problem in nodemcu
dealing with call backs .......I'm apparently doing something wrong but don't know what....
Code: Select all
String Header() {
String h1 = ""; //"HTTP/1.1 200 OK\r\n";
h1 += "<!DOCTYPE HTML>\n";
h1 += "<html lang='en-US'>\n";
h1 += "<head><meta http-equiv='refresh' content="; h1 += RFH; h1 += "></head>\n"; // Page refresh Time
h1 += "<body>\n";
return h1; }
/*--------------------------- This works if I leave out "HTTP/1.1 200 OK\r\n";---------------*/
rfh = RFH; // init refresh ctr
String r = Header();
r += HDR1();
r += JavaScript();
r += Page(); // 14xx
LH = r.length();
LB = 0;
Serial.println(r);
client.print(r);
r = Buttons();
LB = r.length();
client.print(r);
r = Txt();
r += "Baud: "; r += baud; r += " | "; r += LH; r += " | ";
r += LP; r += " | "; r += LB; r += " | ";
LT = r.length()+22;
r += LT;
r += "</body>\n"; r += "</html>\n";
client.print(r); // send the response to the client
client.stop();