I am facing TCP communication lose between server and client when WiFi signal goes to low level say beyond -80dBm. Once client get disconnected, it couldn't connect back and make communication as normal.
How can make client re connection here.
I shall share some part of my code where I am facing issue. Please anyone help me to solve the problem.
void loop(){
Webserver.handleClient();
if (flag) {
if (WiFi.status() != WL_CONNECTED) {
startWIFI();
}
tcpcom();
}
}
void tcpcom() {
int count = 0;
WiFiClient client;
client.setTimeout(1000);
if (client = server.available()) {
while (!client.available()) {
delay(200);
}
while (client.available()) {
input[count] = client.read();
count++;
}
if (DEBUG_MODE)Serial.println(input);
String tcpData;
client.print(tcpData);
delay(5);
client.stop();
client.flush();
}
}
}
}
else {
return;
}
}