I am trying to download 1.4 mb file using tinygsm library, and for that i am using FileDownload example. However my device downloads 96,000 bytes and then stops. After debugging the program i found out that client.connected() condition is turning false and that is why i am not be able to download the file further. Hardware being used is esp32 and sim800c module.
I am sharing the code snippet below, Please guide me resolving this issue.
TinyGsmClientSecure client(modemGSM);
if (client.connect(host, port)) {
SerialDebug.println("connected");
// Make a HTTP GET request:
SerialDebug.println("Performing HTTP GET request...");
client.print(String("GET ") + path + " HTTP/1.1\r\n");
client.print(String("Host: ") + host + "\r\n");
client.print("Connection: close\r\n\r\n");
client.println();
}else {
SerialDebug.println("connection failed");
return;
}
while (client.connected() && millis() - timeout < 10000L) {
while (client.available()) {
char c = client.read();
readBytes++;
if(readBytes % 1000 == 0)
SerialDebug.println(readBytes);
timeout = millis();
}
}