mirror of
				https://github.com/KevinMidboe/TinyGSM.git
				synced 2025-10-29 18:00:18 +00:00 
			
		
		
		
	Correct non-ssl connection
This commit is contained in:
		| @@ -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"); | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user