FTPClient_Generic Library
How To Install Using Arduino Library Manager
Features
This FTPClient_Generic Library is a simple yet complete FTP Client library for AVR, mega-AVR, Portenta_H7, Teensy, SAM DUE, Arduino SAMD21, Adafruit SAMD21/SAMD51, Adafruit nRF52, ESP32/ESP8266, STM32, RP2040-based, etc. boards using either WiFi or Ethernet.
Library is based on and modified from:
1. Leonardo Bispo's ESP32_FTPClient
Changelog
Releases v1.0.0
1. Initial porting and coding to support many more boards, using WiFi or Ethernet
Debug Terminal Output Samples
1. FTPClient_DownloadFile on TEENSY 4.0 with W5x00 using Ethernet_Generic Library on SPI0/SPI
The following is debug terminal output when running example FTPClient_DownloadFile on TEENSY 4.0 with W5x00 using Ethernet_Generic Library on SPI0/SPI.
The FTP Server is Teensy 4.1 using QNEthernet and FTP_Server_Teensy41 library
Code:Starting FTPClient_DownloadFile on TEENSY 4.0 with W5x00 using Ethernet_Generic Library on SPI0/SPI FTPCLIENT_GENERIC v1.0.0 [EWS] =========== USE_ETHERNET_GENERIC =========== [EWS] Default SPI pinout: [EWS] MOSI: 11 [EWS] MISO: 12 [EWS] SCK: 13 [EWS] SS: 10 [EWS] ========================= [EWS] Board : TEENSY 4.0 , setCsPin: 10 [ETG] W5100 init, using SS_PIN_DEFAULT = 10 , new ss_pin = 10 , W5100Class::ss_pin = 10 [ETG] Chip is W5100S [ETG] W5100::init: W5100S, SSIZE = 4096 [EWS] ========================= [EWS] Currently Used SPI pinout: [EWS] MOSI: 11 [EWS] MISO: 12 [EWS] SCK: 13 [EWS] SS: 10 [EWS] ========================= Using mac index = 14 Connected! IP address: 192.168.2.99 [FTP] Connecting to: 192.168.2.241 [FTP] Command connected [FTP] Send USER = teensy4x [FTP] Send PASSWORD = ftp_test [FTP] Send CWD Creating new file helloworld.txt [FTP] Send TYPE Type A [FTP] Send PASV [FTP] outBuf = 227 Entering Passive Mode (4043483328, port 55600) [FTP] _dataAddress: 192.168.2.241 , Data port: 55600 [FTP] Data connection established [FTP] Send STOR [FTP] Write File [FTP] Close File [FTP] Send TYPE Type A [FTP] Send PASV [FTP] outBuf = 227 Entering Passive Mode (4043483328, port 55600) [FTP] _dataAddress: 192.168.2.241 , Data port: 55600 [FTP] Data connection established [FTP] Send RETR [FTP] Result start [FTP] Result: 150-Connected to port 55600 150 18 bytes to download 226-File successfully transferred 226 1 ms, 18 kbytes/s [FTP] Result end timedRead timeout = 1000 The file content is: Hi, I'm a new file [FTP] Send TYPE Type A [FTP] Send PASV [FTP] outBuf = 227 Entering Passive Mode (4043483328, port 55600) [FTP] _dataAddress: 192.168.2.241 , Data port: 55600 [FTP] Data connection established [FTP] Send MLSD [FTP] Result start [FTP] Result: 150 Accepted data connection to port 55600 226-options: -a -l 226 18 matches total [FTP] Result end type=file;modify=20220429231446;size=3810; index1.htm type=file;modify=19800101000000;size=13; foo.txt type=file;modify=20190101003904;size=3714; index2.htm type=file;modify=20220429225004;size=3810; index.htm type=file;modify=20220409222458;size=10; mydatalog.txt type=file;modify=20220313201514;size=4116; edit.htm.gz type=file;modify=20220313201514;size=41214; canadaflag_1.png type=file;modify=20220313201514;size=8311; canadaflag_2.png type=file;modify=20220313201514;size=11156; canadaflag_3.jpg type=file;modify=20190101003834;size=1150; favicon.ico type=file;modify=20220313201514;size=1971; graphs.js.gz type=file;modify=20220429225252;size=8311; canadaflag_2_1.png type=file;modify=20220429225138;size=1547; esp_at_wm_lite.txt type=file;modify=20190101002054;size=18; helloworld.txt type=dir;modify=20190101000020;size=0; mynewdir type=dir;modify=20190101001150;size=0; my_new_dir type=file;modify=20190101001412;size=51695; octocat.jpg type=file;modify=20190101001414;size=11; hello_world.txt File size is: 18 [FTP] Send TYPE Type I [FTP] Send PASV [FTP] outBuf = 227 Entering Passive Mode (4043483328, port 55600) [FTP] _dataAddress: 192.168.2.241 , Data port: 55600 [FTP] Data connection established [FTP] Send RETR [FTP] Result start [FTP] Result: 150-Connected to port 55600 150 18 bytes to download 226 File successfully transferred [FTP] Result end [FTP] Send TYPE Type I [FTP] Send PASV [FTP] outBuf = 227 Entering Passive Mode (4043483328, port 55600) [FTP] _dataAddress: 192.168.2.241 , Data port: 55600 [FTP] Data connection established [FTP] Send MKD [FTP] FTP error: 521 "myNewDir" directory already exists [FTP] Send CWD [FTP] FTP error: 521 "myNewDir" directory already exists [FTP] Send STOR [FTP] FTP error: 521 "myNewDir" directory already exists [FTP] Writing [FTP] FTP error: 521 "myNewDir" directory already exists [FTP] Close File CloseConnection [FTP] Connection closed