I’ve successfully implemented the download of a file (22KB) to an SD card, but it does not seem to work for large files. I need to download a 1MB file. How do I get this working?
My current process is as follows:
AT+QSSLCFG=0,0,“seclevel”,0
AT+QSSLCFG=“ssl”,0,0
AT+QHTTPCFG=“responseheader”,0
AT+QHTTPURL=74
… I enter the URL…
AT+QHTTPGET=80
After about 12 seconds I get the response:
+QHTTPGET: 0,200,998000
I then attempt to download the file by repeatedly doing:
AT+QHTTPREAD=1024
This approach works great for my 22KB test file and takes about 11 seconds. This does not, however, work for my 1MB file. It downloads the first ~7KB and then fails. (I have a 30 seconds timeout waiting for QHTTPREAD to respond.)
Does anyone have any guidance on how to handle large file downloads?
@rastik could you please share this knowledge with me?
I ve got BC660KGLAAR01A05_01.202.01.202 firmware and
AT+QHTTPREAD command stuck with ERROR response after ~40KB of downloading… I need to manage how to download files with size ~250KB…
The best solution I’ve found is (on a non-https endpoint):
Open a TCP connection
Initiate a “send” (AT+QISEND=0), this will respond with an input prompt
Build your own HTTP GET header and submit it (ie: GET /myfile.zip HTTP/1.1\r\nHost: www.somehost.com\r\n\r\n”)
The request will respond with the total filesize and start streaming the data down.
BUT…it sometimes fail to download the complete file (I sometimes have to download 1.6MB), so keep track of the total amount of bytes you have already received and repeat steps 1-4, but add “Range:” to your header so that you start again from where the download failed. Keep doing this until you have all the bytes downloaded.
Can you please share log of such a communication? Which AT commands are you sending and what’s the response? We don’t transfer such large files, but ~80kB works fine.
@dkubeczek Could you please attach the whole communication log of a failed communication? From port opening to the failure? Because the problem can be somewhere in the details.