From c8d71b3b8b6a07bd1a018b186281dd42656c8978 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Wed, 14 Mar 2018 00:59:02 +0200 Subject: [PATCH] Clear buffer on stop(). Fix #119 --- src/TinyGsmClientSIM800.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 8124cda..a86f04e 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -72,6 +72,7 @@ public: public: virtual int connect(const char *host, uint16_t port) { + stop(); TINY_GSM_YIELD(); rx.clear(); sock_connected = at->modemConnect(host, port, mux); @@ -95,6 +96,7 @@ public: at->sendAT(GF("+CIPCLOSE="), mux); sock_connected = false; at->waitResponse(); + rx.clear(); } virtual size_t write(const uint8_t *buf, size_t size) { @@ -191,6 +193,7 @@ public: public: virtual int connect(const char *host, uint16_t port) { + stop(); TINY_GSM_YIELD(); rx.clear(); sock_connected = at->modemConnect(host, port, mux, true);