HTML page it's not show in web Server
LucasMazur opened this issue · 0 comments
Hi, i have a simple problem but to me it's being so dificulty to resolve. It's start recently, i've nerver had tbis problema before, when I connect in NODEMCU web Server in my web (192.168.0.114, for example), the page that i've created in program doesn't show, follow the code bellow:
Note: The download was a succes and I already updated de NODEMCU firmware
`#include <ESP8266WiFi.h>
const char* ssid = "ssid";
const char* password = "password";
WiFiServer server(80);
void setup()
{
Serial.begin(115200);
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
server.begin();
Serial.println("Server started");
Serial.println(WiFi.localIP());
}
void loop()
{
WiFiClient client = server.available();
if (!client)
{
return;
}
Serial.println("new client");
while(!client.available())
{
delay(1);
}
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();
String buf = "";
buf += "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n";
buf += "<html lang="en"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>\r\n";
buf += "<title>ESP8266 Web Server</title>";
buf += "<style>.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:80%;} body{text-align: center;font-family:verdana;} button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;}</style>";
buf += "";
buf += "
ESP8266 Web Server - System Logs
";buf += "\n";
client.print(buf);
client.flush();
Serial.println("Client disonnected");
}`