You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bool testInternetConnection() {
Serial.print("Connecting to ");
Serial.print(server);
Serial.print(":");
Serial.println(port);
if (!client.connected())
{
Serial.println("Client not connected, connecting ... ");
if (!client.connect(server, port)) {
Serial.println("Connection failed");
return false;
}
}
Serial.println("Connected!");
// Make an HTTP GET request
client.print(String("GET /get HTTP/1.1\r\n") +
"Host: " + server + "\r\n" +
"Connection: close\r\n\r\n");
// Wait for response
unsigned long timeout = millis();
while (client.connected() && millis() - timeout < 10000) {
while (client.available()) {
char c = client.read();
//Serial.print(c);
timeout = millis(); // Reset timeout on activity
}
}
//client.stop();
//Serial.println();
//Serial.println("Connection closed");
return true;
}
Scenario, steps to reproduce
When system restarts, I am able to perform network requests. I tried both Http (Mqtt connection). However, the subsequence client.connect(server, port) calls are not successful.
modem.isNetworkConnected() and modem.isGprsConnected() are returning "true" and checking carrier, it showed that modem is connected to the network.
Expected result
I should be able to make connection to different servers or it should not be disconnected soon after successful request.
Actual result
The subsequence connection fails.
Debug and AT command log
Not sure how to do this, but I made change to the code so that it sends AT / response data to serial
Connecting to icanhazip.com:80
### AT:+CACLOSE= 0
DATA:
### AT:+CACID= 0
DATA: OK
### AT:+CASSLCFG= 0 , SSL, 0
DATA: OK
### AT:+CAOPEN= 0 ,0,"TCP"," icanhazip.com ", 80
DATA: +CAOPEN:
DATA: OK
Connected!
### AT:+CASEND= 0 , 61
DATA: >
DATA: OK
### AT:+CARECV?
DATA: OK
### AT:+CASTATE?
DATA: +CASTATE:
DATA: OK
[28214] ### Got Data: 0
DATA:
### AT:+CARECV?
[28243] ### Closed: 0
DATA: +CARECV:
DATA: OK
### AT:+CASTATE?
DATA: +CASTATE:
DATA: OK
### AT:+CARECV= 0 , 63
DATA: +CARECV:
DATA: OK
### AT:+CARECV?
DATA: +CARECV:
DATA: OK
Subsequence:
Connecting to icanhazip.com:80
### AT:+CACLOSE= 0
DATA: OK
### AT:+CACID= 0
DATA: OK
### AT:+CASSLCFG= 0 , SSL, 0
DATA: OK
### AT:+CAOPEN= 0 ,0,"TCP"," icanhazip.com ", 80
DATA:
Connection failed
### AT:+ CEREG ?
DATA: +CAOPEN: 0,23
OK
+CEREG:
DATA: OK
### AT:+CGATT?
DATA: +CGATT:
DATA: OK
### AT:+CNACT?
DATA: +CNACT:
DATA: +CNACT: 1,0,"0.0.0.0"
+CNACT: 2,0,"0.0.0.0"
+CNACT: 3,0,"0.0.0.0"
OK
Connecting to icanhazip.com:80
### AT:+CACLOSE= 0
DATA: OK
### AT:+CACID= 0
DATA: OK
### AT:+CASSLCFG= 0 , SSL, 0
DATA: OK
### AT:+CAOPEN= 0 ,0,"TCP"," icanhazip.com ", 80
Thanks.
The text was updated successfully, but these errors were encountered:
[x] I have read the Troubleshooting section of the ReadMe
What type of issues is this?
[ ] Request to support a new module
[ ] Bug or problem compiling the library
[x] Bug or issue with library functionality (ie, sending data over TCP/IP)
[x] Question or request for help
What are you working with?
Modem: SIMCOM 7080G (waveshare)
Main processor board: ESP32-S3
TinyGSM version: 0.12.0
Code:
Scenario, steps to reproduce
When system restarts, I am able to perform network requests. I tried both Http (Mqtt connection). However, the subsequence
client.connect(server, port)
calls are not successful.modem.isNetworkConnected()
andmodem.isGprsConnected()
are returning "true" and checking carrier, it showed that modem is connected to the network.Expected result
I should be able to make connection to different servers or it should not be disconnected soon after successful request.
Actual result
The subsequence connection fails.
Debug and AT command log
Not sure how to do this, but I made change to the code so that it sends AT / response data to serial
Subsequence:
Thanks.
The text was updated successfully, but these errors were encountered: