I am using this code to transfer data from SD card to an FTP server. It works partially.
The file gets transferred only partially. The source is a text file having 838,736 bytes out of which only 203,968 get transferred. Then the connection closes normally.
There are some errors in the file. Some characters are missing
How can I debug this? What part of the code? Any hints welcome!!
It works. But takes a VERY long time - I aborted twice thinking the transfer had stopped and then added a serial.print where delay is to view progress. It took several minutes for a 800kb file.
Need to fine-tune the transfer timing by adjusting the delay to 1ms.
The (seemingly) strange thing is nothing happens on the FTP server till the entire transfer is done. Any idea why?
Will the delay need to be changed if the available bandwidth is lower?
@pteja, the bottleneck is at the tcp stack. You can reduce the delay but also increase the clientBuf size. Make it progressively larger, adjusting the clientCount threshold accordingly. You could try making it 1024 bytes to see how well that works and tuning the delay as well.
@peekay123 & @RWB - the code @peekay123 posted can also get the data from FTP to SD card. I removed that part of the code since I need SD to FTP transfer only. It must work though.
BTW: The transfer takes such a long time as reported before since the delay(2) was added after every read! It should be only if 64 bytes have been read! So the code should be:
@Jerware Just wanted to confirm that @peekay123 's FTP to SD library is still working for you for downloading files from the web to an SD card attached to a Photon.
What was the largest file size you downloaded successfully using this code?
I’m wanting to download some potentially large files to update a 4D systems LCD display when needed and I’m hoping this may do the job.
@peekay123 Have you played with our updated this library over the last year since this thread was started? I know you recommened using TCP for transferring larger amonts of data like this.
I can test it I just wanted to confirm that the library was working for others as far as downloading to an SD card is concerned before wiring it up and starting down this path.
Sounds like others have had no problem pushing data from the Photon SD card to a server which is nice to hear since it should allow us to upload photo images that a camera puts on the SD card.
@Vitesze You can also try this library for pushing camera images to a server.