Closed
Description
OS: Linux Mint 19.1
Board: ESP32 EVB
I have a server that sends data through a POST request to the ESP32. I am using ESPAsyncWebServer to handle it:
server.on("/post", HTTP_POST, [](AsyncWebServerRequest * request){
if(request->hasArg("number")){
String arg = request->arg("number");
Serial.print("The number is: ");
Serial.println(arg);
} else {
Serial.println("Post did not have a 'number' field.");
}
request->send(200);
});
The issue is that if the server disconnects the ESP hangs, then disconnects from the WiFi and returns the following:
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:353] _eventCallback(): Reason: 200 - BEACON_TIMEOUT
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:353] _eventCallback(): Reason: 4 - ASSOC_EXPIRE
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 8 - STA_LOST_IP
and stays like this. I have seen it reconnect only one time.
How can I force the ESP to reconnect to the WiFi ?