From 0e32caafb884047f7f09ba41337278c0d6ef66ec Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 10 Jan 2020 17:56:05 -0500 Subject: [PATCH] Need to check better for the URC Signed-off-by: Sara Damiano --- src/TinyGsmClientSaraR4.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/TinyGsmClientSaraR4.h b/src/TinyGsmClientSaraR4.h index 31319c8..3e2e6dd 100644 --- a/src/TinyGsmClientSaraR4.h +++ b/src/TinyGsmClientSaraR4.h @@ -623,10 +623,13 @@ protected: "arrival of +UUSOCO: ", mux); sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port, ",1"); - waitResponse(timeout_ms, GF(GSM_NL "+UUSOCO: ")); - stream.readStringUntil(',').toInt(); // skip repeated mux - int connection_status = stream.readStringUntil('\n').toInt(); - return (0 == connection_status); + if (waitResponse(timeout_ms, GF(GSM_NL "+UUSOCO: ")) == 1) { + stream.readStringUntil(',').toInt(); // skip repeated mux + int connection_status = stream.readStringUntil('\n').toInt(); + return (0 == connection_status); + } else { + return false; + } } else { // use synchronous open sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port);