You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was run server on Wemos D1 mini, when ESP transmit TCP packet, and client isn't received, the ESP was hanged, and only reset help. Who know how to check while "client.printing" is the client available yet or not?
the Code below
#include <ESP8266WiFi.h>
const char* ssid = "my_network";
const char* password = "mynetpass";
WiFiServer server(80);
void setup() {
Serial.begin(115200);
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");
Serial.println(WiFi.localIP());
server.begin();
Serial.println("Server started");
}
WiFiClient client;
unsigned long angam=0;
unsigned long jam[2]; // debug
// unsigned long jam;
void loop() {
jam[0] = millis();//debug
//jam = millis();
client = server.available();
if(!client){
return;
}
jam[1] = millis(); // debug
Serial.println("server is available"); // debug
angam++;
Serial.println();
Serial.println();
Serial.println();
while(!client.available()){
delay(1);
if(millis() - jam[1] > 5000) return;
}
Serial.print("client is available "); //debug
Serial.println(millis() - jam[1]); //debug
Serial.print(client.remoteIP());
Serial.println(" " + client.readStringUntil('\r'));
Serial.println("start flush"); //debug
jam[1] = millis(); //debug
client.flush();
Serial.print("flush end "); //debug
Serial.println(millis() - jam[1]); //debug
Serial.println("Start client print "); //debug
client.print("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html>");
client.print("Server is ready " + String(angam) + "\n");
client.print("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, ");
client.print("</html>\n");
Serial.println("Client print succesfull");
Serial.println(millis() - jam[0]); //debug
//Serial.println(millis() - jam);
}
The text was updated successfully, but these errors were encountered:
I was run server on Wemos D1 mini, when ESP transmit TCP packet, and client isn't received, the ESP was hanged, and only reset help. Who know how to check while "client.printing" is the client available yet or not?
the Code below
The text was updated successfully, but these errors were encountered: