Added hack to close sockets

This commit is contained in:
SRGDamia1
2017-04-13 14:10:11 -04:00
parent eac16fb02e
commit 88fe00e98e

View File

@@ -87,7 +87,21 @@ public:
return sock_connected;
}
virtual void stop() { // Not supported
// This is a hack to shut the socket by setting the timeout to zero and
// then sending an empty line to the server.
virtual void stop() {
TINY_GSM_YIELD();
at->commandMode();
at->sendAT(GF("TM0")); // Set socket timeout to 0;
at->writeChanges();
at->exitCommand();
at->modemSend("", 1, mux);
at->waitResponse();
delay(200);
at->commandMode();
at->sendAT(GF("TM64")); // Set socket timeout back to 10seconds;
at->writeChanges();
at->exitCommand();
sock_connected = false;
}