Socket will not be closed when Connection failes
Created by: Chris685
At the Arduino Example the Network sockets will not be closed when the Connection could not be established. After 4 trys - my WiFi stopps working and could only be started to work.
My workaround was to put the disconnect directly to the loop, so it will called every loop - also if succesfull or unsuccesfull.
Original Code from Example:
void loop() {
if (connect(server)) {
if (sendRequest(server, resource) && skipResponseHeaders()) {
UserData userData;
if (readReponseContent(&userData)) {
printUserData(&userData);
}
}
**disconnect();**
}
wait();
}
My Workaround:
void loop() {
if (connect(server)) {
if (sendRequest(server, resource) && skipResponseHeaders()) {
UserData userData;
if (readReponseContent(&userData)) {
printUserData(&userData);
}
}
}
**disconnect();**
wait();
}