Browse Source

Added hack to close sockets

v_master
SRGDamia1 7 years ago
parent
commit
88fe00e98e
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      TinyGsmClientXBee.h

+ 15
- 1
TinyGsmClientXBee.h View File

@ -87,7 +87,21 @@ public:
return sock_connected; 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; sock_connected = false;
} }


Loading…
Cancel
Save