FTP client connection

I store data in the flash of the spark. On a regular interval I want to transfer these data in bulk. Is there a way to make an FTP connection and to send the contents of the flash as a file to an FTP server?

You can use the TCPClient library to do this. I’m familiar enough with most of FTP to know that it shouldn’t be terribly difficult. I’ve never actually messed with how to upload/download files and read them from or write to disk. The rest of the protocol is simple plain text. If I get a free minute, I might be able to play around with it some. @bko may have some good ideas regarding this, too.

Hi All,

FTP requires two TCP/IP channels, one that stays connected the whole time for comands and a separate one for the data transfer that can go up and down throughout the process of moving data.

I think this is very much possible on the Spark core, but memory could be challenge. I have been thinking about a FTP server rather than a client for the core, but the work is about the same really. There is a somewhat incomplete Arduino library for an FTP server that could be a starting point.

One question is, how much data to you have to transfer and how quickly or slowly do you need it?

You could do a simple transfer using Spark.function() and Spark.publish() as long as you didn’t exceed the publish rate limit of one per second on average. That would get you somewhere around 64-bytes per second but would be very easy to implement today.

1 Like