New FTPClient_Generic Library

FTPClient_Generic library GitHub release
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


Currently supported Boards using Ethernet

This FTPClient_Generic library currently supports these following boards:

  1. nRF52 boards, such as AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.
  2. SAM DUE
  3. SAMD21
  • Arduino SAMD21: ZERO, MKRs, NANO_33_IOT, etc.
  • Adafruit SAMD21 (M0): ItsyBitsy M0, Feather M0, Feather M0 Express, Metro M0 Express, Circuit Playground Express, Trinket M0, PIRkey, Hallowing M0, Crickit M0, etc.
  • Seeeduino: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, etc.
  1. SAMD51
  • Adafruit SAMD51 (M4): Metro M4, Grand Central M4, ItsyBitsy M4, Feather M4 Express, Trellis M4, Metro M4 AirLift Lite, MONSTER M4SK Express, Hallowing M4, etc.
  • Seeeduino: Wio Terminal, Grove UI Wireless
  1. Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC) with SPI, SPI1, SPI2

  2. AVR Mega1280, 2560, ADK.

  3. ESP32

  4. ESP8266

  5. RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core or Earle Philhower's arduino-pico core with SPI, SPI1

  6. Portenta_H7

  7. Arduino UNO WiFi Rev2, AVR_NANO_EVERY, etc.


Currently supported Ethernet shields/modules

  1. W5x00 using Ethernet_Generic library
  2. W5x00 using Ethernet, EthernetLarge, Ethernet2 or Ethernet3 library
  3. ENC28J60 using EthernetENC or UIPEthernet library
  4. Teensy 4.1 built-in Ethernet using NativeEthernet library
  5. Teensy 4.1 built-in Ethernet using QNEthernet library
  6. Portenta_H7 Ethernet using Portenta_Ethernet library


Currently Supported Boards using WiFi

This FTPClient_Generic library currently supports these following boards:

  1. SAM DUE

  2. SAMD21

  • Arduino: ZERO, MKR, NANO_33_IOT, etc.
  • Adafruit SAMD21 (M0) : ItsyBitsy M0, Feather M0, Feather M0 Express, Metro M0 Express, Circuit Playground Express, Trinket M0, PIRkey, HalloWing M0, Crickit M0, etc.
  • Seeeduino: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, etc.
  1. SAMD51
  • Adafruit SAMD51 (M4) : Metro M4, Grand Central M4, ItsyBitsy M4, Feather M44 Express, Trellis M4, Metro M4 AirLift lite, MONSTER M4SK Express, Hallowing EM4 xpress, etc.
  • Seeeduino: Wio Terminal, Grove UI Wireless
  1. Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC)

  2. All STM32F/L/H/G/WB/MP1 with more than 32KB flash memory.

  3. AVR Mega1280, 2560, ADK, 32U4, 16U4, etc. using Arduino, Adafruit or Sparkfun core. To use patch for ArduinoSTL library.

  4. RP2040-based boards, such as Nano RP2040 Connect, using Arduino-mbed RP2040 core or Earle Philhower's arduino-pico core

  5. RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core or Earle Philhower's arduino-pico core.

  6. ESP32

  • ESP32 boards, such as ESP32_DEV, etc.
  • ESP32S2-based boards, such as ESP32S2_DEV, ESP32_S2 Saola, etc.
  • ESP32C3-based boards, such as ESP32C3_DEV, etc. New
  • ESP32_S3 (ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.) New
  1. ESP8266

  2. Portenta_H7

  3. nRF52 boards, such as AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.

  4. Arduino megaAVR boards using Arduino core

  • UNO WiFi Rev2 : WiFi101 New
  • Nano Every : WiFiEspAT New
  1. CO2 Ampel
  • SAMD : WiFi101 New
  1. STM32 using STM32duino Maple core. New

  2. Sparkfun SAMD

  • SAMD21, SAMD51 : WiFiEspAT New
  1. Industruino SAMD
  • D21G : WiFiEspAT New
  1. Tlera Corp STM32WB boards
  • Firefly-WB55RG, Nucleo-WB55RG, etc. : WiFiEspAT New
  1. Maixduino boards
  • Sipeed Maixduino, etc. : WiFiEspAT New
  1. RTL8720DN using Realtek AmebaD core New

  2. Arduino, Sparkfun, Adafruit, etc. AVR boards (Mega, 32U4, etc.). To use patch for ArduinoSTL library New

  • Arduino Uno / Mega / Duemilanove / Diecimila / LilyPad / Mini / Fio / Nano, etc.
  • Arduino ATMega 16U4, 32U4 such as AVR Leonardo, Leonardo ETH, YUN, Esplora, LILYPAD_USB, AVR_ROBOT_CONTROL, AVR_ROBOT_MOTOR, AVR_INDUSTRIAL101, etc.
  • Adafruit ATMega 32U4 such as AVR_FLORA8, AVR_FEATHER32U4, AVR_CIRCUITPLAY, AVR_ITSYBITSY32U4_5V, AVR_ITSYBITSY32U4_3V, AVR_BLUEFRUITMICRO, AVR_ADAFRUIT32U4, etc.
  • Adafruit ATMega 328(P) such as AVR_METRO, AVR_FEATHER328P, AVR_PROTRINKET5, AVR_PROTRINKET3, AVR_PROTRINKET5FTDI, AVR_PROTRINKET3FTDI, etc.
  • Generic or Sparkfun AVR ATmega_32U4 such as AVR_MAKEYMAKEY, AVR_PROMICRO, etc.
  • Generic or Sparkfun AVR ATmega_328(P) such as ARDUINO_REDBOT, ARDUINO_AVR_DIGITAL_SANDBOX, etc.
  • Generic or Sparkfun AVR ATmega128RFA1 such as ATMEGA128RFA1_DEV_BOARD, etc.

Currently supported WiFi shields/modules

  1. WiFiNINA using WiFiNINA_Generic library
  2. WiFi101 using WiFi101 library or Modified WiFi101 Library v0.16.1+
  3. u-blox W101, W102 using WiFiNINA_Generic library
  4. ESP8266-AT command using WiFiEspAT library
  5. ESP8266/ESP32-AT command using ESP_AT_Lib library
  6. Built-in WiFi of ESP32, ESP8266
  7. Built-in WiFi of Portenta_H7


Changelog

Releases v1.0.0

  1. Initial porting and coding to support many more boards, using WiFi or Ethernet

Examples:

Ethernet Examples

  1. FTPClient_DownloadFile
  2. FTPClient_UploadImage
  3. FTPClient_DownloadFile_RP2040_SPI1
  4. FTPClient_DownloadFile_STM32_LAN8742A
  5. FTPClient_UploadImage_STM32_LAN8742A

WiFi Examples

  1. FTPClient_DownloadFile
  2. FTPClient_UploadImage

General Example

  1. multiFileProject

Debug Terminal Output Samples

1. FTPClient_DownloadFile on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

The following is debug terminal output when running example FTPClient_DownloadFile on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

Starting FTPClient_DownloadFile on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
FTPCLIENT_GENERIC v1.0.0
[EWS] ======== USE_PORTENTA_H7_ETHERNET ========
Using mac index = 13
Connected! IP address: 192.168.2.123
[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
[FTP] Result end
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
226 1 ms, 18 kbytes/s
[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

Releases v1.3.0

  1. Fix uploading issue of large files for WiFi, QNEthernet

Releases v1.2.1

  1. Auto detect server response type in PASV mode

Releases v1.2.0

  1. Add support to other new FTP Servers, such as vsftpd in Linux, Ubuntu, Rasbberry Pi, etc.
  2. Fix bug
  3. Update examples

Releases v1.1.0

  1. Add support to Teensy 4.1 using QNEthernet or NativeEthernet
  2. Add examples for QNEthernet and NativeEthernet

FTPClient_UploadImage on TEENSY 4.1 with QNEthernet

The following is debug terminal output and directory listing after running example FTPClient_UploadImage on TEENSY 4.1 with using QNEthernet, connecting to vsftpd server

Starting FTPClient_UploadImage on TEENSY 4.1 with QNEthernet
FTPCLIENT_GENERIC v1.3.0
[EWS] =========== USE_QN_ETHERNET ===========
Initialize Ethernet using static IP => IP Address = 192.168.2.222
[FTP] Connecting to:  192.168.2.112
[FTP] Command connected
[FTP] Send USER =  ftp_test
[FTP] Send PASSWORD =  ftp_test
[FTP] Send CWD
[FTP] Send TYPE Type A
[FTP] Send PASV
[FTP] outBuf = 227 Entering Passive Mode (192,168,2,112,203,166).

[FTP] Data port:  52134
[FTP] _dataAddress:  192.168.2.112 , Data port:  52134
[FTP] Data connection established
[FTP] Send LIST
[FTP] Result:  150 Here comes the directory listing.
226 Directory send OK.
NewDir
hello_world.txt
helloworld.txt
Writing octocat.jpg, size = 51695
[FTP] Send TYPE Type I
[FTP] Send PASV
[FTP] outBuf = 227 Entering Passive Mode (192,168,2,112,215,146).
[FTP] Data port:  55186
[FTP] _dataAddress:  192.168.2.112 , Data port:  55186
[FTP] Data connection established
[FTP] Send STOR
[FTP] Writing
[FTP] WriteData: datalen =  51695
[FTP] Close File
Writing hello_world.txt
[FTP] Send TYPE Type A
[FTP] Send PASV
[FTP] outBuf = 227 Entering Passive Mode (192,168,2,112,127,205).
[FTP] Data port:  32717
[FTP] _dataAddress:  192.168.2.112 , Data port:  32717
[FTP] Data connection established
[FTP] Send STOR
[FTP] Write File
[FTP] Close File
[FTP] Connection closed
  • Directory listing
pi@raspberrypi-02:/home/ftp_test $ ls -la
total 84
drwxrwxrwx 3 ftp_test ftp_test  4096 May 16 21:26 .
drwxr-xr-x 4 root     root      4096 May 14 16:55 ..
-rw-r--r-- 1 ftp_test ftp_test   220 May 14 16:55 .bash_logout
-rw-r--r-- 1 ftp_test ftp_test  3523 May 14 16:55 .bashrc
-rwxrwxrwx 1 ftp_test ftp_test    11 May 16 21:26 hello_world.txt
-rwxrwxrwx 1 ftp_test ftp_test    75 May 16 20:29 helloworld.txt
drwx------ 2 ftp_test ftp_test  4096 May 16 20:19 NewDir
-rw------- 1 ftp_test ftp_test 51695 May 16 21:26 octocat.jpg
-rw-r--r-- 1 ftp_test ftp_test   807 May 14 16:55 .profile

Hi, thank you for the library.
I have a probleme when reading a .txt content: Between two requests the library waits about 5 or 6 secondes.

Here is my sketch

    if(ftp.isConnected()==1){
      FtpRead = 1;
      ftp.ChangeWorkDir(dirName);    //Change de répertoire

      //Lire le fichier
      String response = "";
      ftp.InitFile(COMMAND_XFER_TYPE_ASCII);
//      ftp.InitFile("Type A");
      ftp.DownloadString(fileName, response);

The serial port exit

14:26:42.484 -> Connecting.......
14:26:46.405 -> Connected, IP address: 192.168.43.251
14:26:46.405 -> SSID: Makomo8
14:26:46.405 -> WiFi OK
14:26:46.405 -> Connection au serveur FTP
14:26:46.829 -> Connecté au serveur FTP
14:26:52.401 -> The file content is:  etat<playing>Artist<Thievery CorporationArtist>Album<It Takes a ThiefAlbum>Titre<Holographic UniverseTitre>Bitrate<320Bitrate>Codec<MP3Codec>Duree<3:42Duree>
14:26:58.351 -> The file content is:  etat<playing>Artist<Thievery CorporationArtist>Album<It Takes a ThiefAlbum>Titre<Holographic UniverseTitre>Bitrate<320Bitrate>Codec<MP3Codec>Duree<3:42Duree>
14:27:03.990 -> The file content is:  etat<playing>Artist<Thievery CorporationArtist>Album<It Takes a ThiefAlbum>Titre<Holographic UniverseTitre>Bitrate<320Bitrate>Codec<MP3Codec>Duree<3:42Duree>
14:27:09.677 -> The file content is:  etat<playing>Artist<Thievery CorporationArtist>Album<It Takes a ThiefAlbum>Titre<Holographic UniverseTitre>Bitrate<320Bitrate>Codec<MP3Codec>Duree<3:42Duree>
14:27:15.845 -> The file content is:  etat<playing>Artist<Thievery CorporationArtist>Album<It Takes a ThiefAlbum>Titre<Holographic UniverseTitre>Bitrate<320Bitrate>Codec<MP3Codec>Duree<3:42Duree>

and my FTP server logs

(000004)06/06/2022 17:03:19 - (not logged in) (192.168.1.40)> Connected on port 21, sending welcome message...
(000004)06/06/2022 17:03:19 - (not logged in) (192.168.1.40)> 220 .
(000004)06/06/2022 17:03:20 - (not logged in) (192.168.1.40)> USER Arduino
(000004)06/06/2022 17:03:20 - (not logged in) (192.168.1.40)> 331 Password required for arduino
(000004)06/06/2022 17:03:20 - (not logged in) (192.168.1.40)> PASS *******
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> 230 Logged on
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> CWD /
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> PASV
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,239,205)
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> Type A
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> 200 Type set to A
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000004)06/06/2022 17:03:20 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000004)06/06/2022 17:03:25 - arduino (192.168.1.40)> CWD /
(000004)06/06/2022 17:03:25 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000004)06/06/2022 17:03:25 - arduino (192.168.1.40)> PASV
(000004)06/06/2022 17:03:25 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,230,17)
(000004)06/06/2022 17:03:25 - arduino (192.168.1.40)> Type A
(000004)06/06/2022 17:03:25 - arduino (192.168.1.40)> 200 Type set to A
(000004)06/06/2022 17:03:26 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000004)06/06/2022 17:03:26 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000004)06/06/2022 17:03:26 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> CWD /
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> PASV
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,196,180)
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> Type A
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> 200 Type set to A
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000004)06/06/2022 17:03:31 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:38 - (not logged in) (192.168.1.40)> Connected on port 21, sending welcome message...
(000005)06/06/2022 17:03:38 - (not logged in) (192.168.1.40)> 220 .
(000005)06/06/2022 17:03:38 - (not logged in) (192.168.1.40)> USER Arduino
(000005)06/06/2022 17:03:38 - (not logged in) (192.168.1.40)> 331 Password required for arduino
(000005)06/06/2022 17:03:38 - (not logged in) (192.168.1.40)> PASS *******
(000005)06/06/2022 17:03:38 - arduino (192.168.1.40)> 230 Logged on
(000005)06/06/2022 17:03:38 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:03:38 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:03:39 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:03:39 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,255,134)
(000005)06/06/2022 17:03:39 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:03:39 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:03:39 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:03:39 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:39 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,250,74)
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:44 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:49 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:03:49 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:03:49 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:03:49 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,216,68)
(000005)06/06/2022 17:03:49 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:03:49 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:03:50 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:03:50 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:50 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,198,21)
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:03:55 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,246,237)
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:00 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,225,170)
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:06 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,251,236)
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:11 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:16 - arduino (192.168.1.40)> CWD /
(000005)06/06/2022 17:04:16 - arduino (192.168.1.40)> 250 CWD successful. "/" is current directory.
(000005)06/06/2022 17:04:16 - arduino (192.168.1.40)> PASV
(000005)06/06/2022 17:04:16 - arduino (192.168.1.40)> 227 Entering Passive Mode (192,168,1,16,214,22)
(000005)06/06/2022 17:04:17 - arduino (192.168.1.40)> Type A
(000005)06/06/2022 17:04:17 - arduino (192.168.1.40)> 200 Type set to A
(000005)06/06/2022 17:04:17 - arduino (192.168.1.40)> RETR Foobar_Now_Playing.txt
(000005)06/06/2022 17:04:17 - arduino (192.168.1.40)> 150 Opening data channel for file download from server of "/Foobar_Now_Playing.txt"
(000005)06/06/2022 17:04:17 - arduino (192.168.1.40)> 226 Successfully transferred "/Foobar_Now_Playing.txt"

Do you know what is the cause of these 5 or 6 secondes delay ?
Thx ^^

Hi @mimikrakra

Thanks for using the library.

Please have a detailed look at your code and optimize it a little bit.

For example: why do you have to ChangeWorkDir(), and DownloadString() repetitively for reading just a short String. Why not reading the large file just once, then process it gradually.

Anyway, in order for getting the better help from many more people, I suggest you post the Minimal, Reproducible Example.

Good Luck,

Hi, thank you for answering.
In this file "/src/FTPClient_Generic_Impl.h" its this part who takes time processing

  while ( GetDataClient()->available() )
  {
    str += GetDataClient()->readString();
  }

What do you mean by "Why not reading the large file just once, then process it gradually." ?
I need to check de file content frequently ...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.