From 2e03cdeaba8791dbbc0ba2ba067d92a283006246 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 20 May 2019 10:37:30 -0400 Subject: [PATCH] Correct non-ssl connection --- examples/WebClient/WebClient.ino | 9 +++++---- src/TinyGsmClientBG96.h | 2 +- src/TinyGsmClientESP8266.h | 2 +- src/TinyGsmClientM95.h | 2 +- src/TinyGsmClientMC60.h | 2 +- src/TinyGsmClientSIM7000.h | 2 +- src/TinyGsmClientSIM800.h | 2 +- src/TinyGsmClientSaraR4.h | 2 +- src/TinyGsmClientSequansMonarch.h | 2 +- src/TinyGsmClientUBLOX.h | 2 +- src/TinyGsmClientXBee.h | 2 +- 11 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/WebClient/WebClient.ino b/examples/WebClient/WebClient.ino index 53095ef..6bce77d 100644 --- a/examples/WebClient/WebClient.ino +++ b/examples/WebClient/WebClient.ino @@ -138,7 +138,7 @@ void loop() { #endif SerialMon.print("Waiting for network..."); - if (!modem.waitForNetwork()) { + if (!modem.waitForNetwork(240000L)) { SerialMon.println(" fail"); delay(10000); return; @@ -146,12 +146,12 @@ void loop() { SerialMon.println(" OK"); if (modem.isNetworkConnected()) { - SerialMon.print("Network connected"); + SerialMon.println("Network connected"); } #if TINY_GSM_USE_GPRS SerialMon.print(F("Connecting to ")); - SerialMon.print(apn); + SerialMon.println(apn); if (!modem.gprsConnect(apn, gprsUser, gprsPass)) { SerialMon.println(" fail"); delay(10000); @@ -161,7 +161,7 @@ void loop() { #endif SerialMon.print("Connecting to "); - SerialMon.print(server); + SerialMon.println(server); if (!client.connect(server, port)) { SerialMon.println(" fail"); delay(10000); @@ -170,6 +170,7 @@ void loop() { SerialMon.println(" OK"); // Make a HTTP GET request: + SerialMon.println("Performing HTTP GET request..."); client.print(String("GET ") + resource + " HTTP/1.0\r\n"); client.print(String("Host: ") + server + "\r\n"); client.print("Connection: close\r\n\r\n"); diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 55782e4..c1f7e2c 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -75,7 +75,7 @@ public: stop(); TINY_GSM_YIELD(); rx.clear(); - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index 3ceefc2..e1f6608 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -72,7 +72,7 @@ public: stop(); TINY_GSM_YIELD(); rx.clear(); - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index 9754668..18c90d7 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -75,7 +75,7 @@ public: stop(); TINY_GSM_YIELD(); rx.clear(); - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index 81648d2..cef00d6 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -79,7 +79,7 @@ public: stop(); TINY_GSM_YIELD(); rx.clear(); - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index 9fbda33..dfb259f 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -80,7 +80,7 @@ public: stop(); TINY_GSM_YIELD(); rx.clear(); - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 4987f07..934dc81 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -81,7 +81,7 @@ public: stop(); TINY_GSM_YIELD(); rx.clear(); - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } diff --git a/src/TinyGsmClientSaraR4.h b/src/TinyGsmClientSaraR4.h index b0e2cd0..72fce09 100644 --- a/src/TinyGsmClientSaraR4.h +++ b/src/TinyGsmClientSaraR4.h @@ -94,7 +94,7 @@ public: rx.clear(); uint8_t oldMux = mux; - sock_connected = at->modemConnect(host, port, &mux, timeout_s); + sock_connected = at->modemConnect(host, port, &mux, false, timeout_s); if (mux != oldMux) { DBG("WARNING: Mux number changed from", oldMux, "to", mux); at->sockets[oldMux] = NULL; diff --git a/src/TinyGsmClientSequansMonarch.h b/src/TinyGsmClientSequansMonarch.h index 892120c..1fb2615 100644 --- a/src/TinyGsmClientSequansMonarch.h +++ b/src/TinyGsmClientSequansMonarch.h @@ -87,7 +87,7 @@ public: if (sock_connected) stop(); TINY_GSM_YIELD(); rx.clear(); - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index eef2fa1..f86d1d6 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -78,7 +78,7 @@ public: rx.clear(); uint8_t oldMux = mux; - sock_connected = at->modemConnect(host, port, &mux, timeout_s); + sock_connected = at->modemConnect(host, port, &mux, false, timeout_s); if (mux != oldMux) { DBG("WARNING: Mux number changed from", oldMux, "to", mux); at->sockets[oldMux] = NULL; diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 8f812d9..2a1c1c1 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -99,7 +99,7 @@ public: virtual int connect(const char *host, uint16_t port, int timeout_s) { // NOTE: Not caling stop() or yeild() here at->streamClear(); // Empty anything in the buffer before starting - sock_connected = at->modemConnect(host, port, mux, timeout_s); + sock_connected = at->modemConnect(host, port, mux, false, timeout_s); return sock_connected; } virtual int connect(const char *host, uint16_t port) {