Help with FTPClient library

Hello everyone!
I use a F401RE board to which I connected an esp8266 module and some sensors.
The board collects the data of some sensors and I would like it to send the data to a server via the wifi module. The wifi module already connects to the internet. I had therefore thought of making an FTP connection to test everything.
The problem is that, being new to this environment, I’m still not very good; so i can’t figure out how to use the library properly.
I attach link: ftp-client - FTP client library for mbed-os | Mbed
If someone were willing to help me I would be very happy!

Hello,

The library is for older MbedOS version and Network interface what MbedOS provide.
So questions are:

  • what a version of MbedOS do you use or do you want to use?
  • how you control your ESP8266? Directly via AT commands, or via a community library, or via Mbed ESP8266Interface?

BR, Jan

I apologize for the delay,

I didn’t know that the library was deprecated. I’m trying to open a FTP connection to send files from my esp.
I’m using mbed-cli 1.8.3 on eclipse (gcc_arm compiler) and ESP8266Interface.

Hello,

the library was made in 2018 so it was designed for MbedOS 5.8 or similar version. But it seems it is possible to use it with version 5.15 (with lot of warnings about deprecated parts of MbedOS but it is OK ).

I made only small change in original, for compatibility with the MbedOS 6+. If you want to test it, you can - ​ftp-client . I tried only download some info from a test server, like files names.

BR, Jan

Thanks for help,
I’m using your library but i get some problems.
This in the snippet of ftp connection:

void ftpConn(NetworkInterface *net) {

	const char root[] = "root";
	FTPClient ftp(net,root);

	const char ip[] = "192.168.178.26";  //local ip of ftp server
	const char user[] = "esp"; //username set on ftp server
	const char pwd[] = "esp8266";  //pwd set on ftp server
	ftp.open(SocketAddress(ip,14147),user,pwd);
}

Compilation works, but when i load .bin file in my board i get this error on serial monitor:
ERROR: .\ftp-client-c96c0b0c92df\FTPClient.cpp(43)

P.S.

I’m pretty sure the root parameter has to do with it, because I don’t understand what it’s for.
Thanks for your help.

Hi Daniele,

Because the FTP is for file handling, the root will be probably not root as a word but root as a root folder of a FileSystem - Data storage - API references and tutorials | Mbed OS 6 Documentation.

BR, Jan

Hi,

Thanks a lot for your help, the ftp connection was successful. now I have to figure out how to create a file on the board.
Thanks again!

You are welcome.
How big a file should it be?

BR, Jan

The file should be a few KB in size.
Are there any methods for not having to use SD media on the F401RE?

For a File you probably need a File system, I think, and also both Mbed’s FileSystems seems to be designed for an external hardware, as the description says.

Maybe you can modify the library and change the file handling with a buffer handling.

BR, Jan