Closed gioreva closed 3 years ago
Hi, Did you configure Filezilla for using the primary connection for data transfers ? Did you try to uncomment #define FTP_DEBUG and #define FTP_DEBUG1 in FtpServer.h ? Did you read the discussion about the library in arduino forum ? https://forum.arduino.cc/index.php?topic=182382.0
yes yes no
Today it works, but I only changed Debug and Serial with SerialUSB I have not changed anything in the Ethernet library. There is something unstable, I'll see in future trials.
One thing. I need to know, inside the loop, when it is ended the connection, for process received files. But you've put all the information private. How can I do ?
This Debug https://pastebin.com/XYY9LYW3
Hi Good news that you were able to get the library to work I never test my library with an Arduino Zero ( original or clone) but according to documentation, replace Serial by SerialUsb is specific to Arduino Zero family.
I need to know, inside the loop, when it is ended the connection, for process received files. But you've put all the information private.
Yes, writing a class, it is good practice to put private variables not used by external code.
But it is a good idea to make the state of the server accessible.
I think it is quite simple:
Variable cmdStage reflect the state of the server. It can take value described by enum ftpCmd. See FtpServer.h
So, make the following changes:
In FtpServer.h at line 97 replace
void service();
by
ftpCmd service();
In FtpServer.cpp at line 98 replace
void FtpServer::service()
by
void FtpServer::service()
at line 107
return;
by
return cmdStage;
and before end of fonction service() (line 192), add
return cmdStage;
So, in your loop(), when ftpSrv.service() return 0 (value for FTP_Stop), you know than the server is idle. Please, tell me if this is working, as I can't test it myself right now.
Note that you can uncomment line 43 in FtpServer.h in order to print values of variable cmdStage.
Then you made Change on the library and i test for you ? Add also
And about router/NAT, you are able to access from outside ?
I opened the port 20 21 TCP, but it tells me Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server".
I have tryed. Also Without Test work well.
Hi I am not sure to understand you (my english is not very good) So you make the change and they give you the desired result? In that case, I shall publish them when I have some time.
And about router/NAT, you are able to access from outside ?
Yes, You must configure the client in passive mode. Note that according to my experience and that of other users, FTPRush give better results than FileZilla. Please take a look at the discussion on the forum, it will help you understand the usage of this library and resolve some issues
I created my first folk, and I made the changes you requested. But I do not receive 0 but I get the first 1 then 2
=== Test of FTP Server === Mount the SD card with library FatFs ... ok Initialize ethernet module ... W5500 ok IP address of server: 192.168.1.70 Free stack: 25136 New State 1 Ftp server waiting for connection on port 21 New State 2 Client connected! New State 3 USER arduino New State 4 PASS test Authentication Ok. Waiting for commands. New State 5 PWD TYPE I PASV Connection management set to passive Data port set to 55600 MLSD New State 1 Ftp server waiting for connection on port 21 New State 2
I cannot reply on the forum.
The message has the following error or errors that must be corrected before continuing:
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
You have no permission to post in this topic. If you really want to post here - please contact moderator to bump this topic.
I cannot access at the server after NAT I open ports 20 and 21 and 55600 TCP Set Passive mode on the client. It seems that no port 21 work for start.
=== Test of FTP Server ===
Mount the SD card with library FatFs ... ok
Initialize ethernet module ... W5500 ok
IP address of server: 192.168.1.70
Free stack: 25136
Ftp server waiting for connection on port 21
I tried to change the port
To open the 19-20-21
But also no longer it works locally.
Hi
I do not receive 0 but I get the first 1 then 2
You are right. I admit that I wanted to answer too quickly. As briefly and badly described in definition of enum ftpCmd: Values of cmdStage 0 and 1 are transients Value 2 indicates the serveur is waiting for a connection (idle) Values 3 and 4 are for authentication Value 5 indicates that client is connected.
So, I think you can use in your loop()
if( ftpSrv.service()) > 2 )
to know that the server is busy.
Please tell me if this solves your needs.
About the access from outside I have an application running at home. Give me some time to test access outside the local network
Yes, this solves My needs.
I have also the need to change user passwords and runtime. Also I put this in the folk, then, if you want, you can make folk back.
I'm trying with filezilla, because I need the function to edit text files, remotely.
Yes, this solves My needs.
Good. I would update the code when I had time
I put this in the folk
I am sorry, I don't understand the meaning of "folk". Can you explain me?
https://github.com/gioreva/Arduino-Ftp-Server This is folk of your project. I have made and tested change on this folk.
After I add user passwords and runtimes.
I think you can accept the changes, and make a folk back Import automatically changes in your project.
This is folk of your project
Ok! Good work! But I think the correct word is not folk (like people, humans...) but fork (like branch)
I warn you when I test remote access
Haaa, ok, folk, fork
No, is not my project. Is your project, with change that you have proposed.
And small other.
I'm trying to use SdFat
on .ino
on ftpServer.h
instead of
But it will not compile:
Arduino: 1.8.13 (Windows 10), Board: "Arduino Zero (Native USB Port)"
In file included from C:\Users\x-gio\Documents\Project\Geva\GEVINO Common\GEVINO_Example_Manual\GEVINO_Opto_NPN\FtpServer\FtpServer.ino:30:0:
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:116:20: error: 'FAT_DIR' has not been declared
bool openDir( FAT_DIR * pdir, char * sdir = NULL );
^~~~~~~
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:126:3: error: 'FAT_FILE' does not name a type; did you mean 'FAT_TIME'?
FAT_FILE file;
^~~~~~~~
FAT_TIME
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:127:3: error: 'FAT_DIR' does not name a type; did you mean 'FAT_DAY'?
FAT_DIR dir;
^~~~~~~
FAT_DAY
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:57:22: error: 'FF_MAX_LFN' was not declared in this scope
#define FTP_CMD_SIZE FF_MAX_LFN+8 // max size of a command
^
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:135:21: note: in expansion of macro 'FTP_CMD_SIZE'
char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client
^~~~~~~~~~~~
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:57:22: note: suggested alternative: 'INTMAX_MIN'
#define FTP_CMD_SIZE FF_MAX_LFN+8 // max size of a command
^
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:135:21: note: in expansion of macro 'FTP_CMD_SIZE'
char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client
^~~~~~~~~~~~
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:58:22: error: 'FF_MAX_LFN' was not declared in this scope
#define FTP_CWD_SIZE FF_MAX_LFN+8 // max size of a directory name
^
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:136:21: note: in expansion of macro 'FTP_CWD_SIZE'
char cwdName[ FTP_CWD_SIZE ]; // name of current directory
^~~~~~~~~~~~
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:58:22: note: suggested alternative: 'INTMAX_MIN'
#define FTP_CWD_SIZE FF_MAX_LFN+8 // max size of a directory name
^
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:136:21: note: in expansion of macro 'FTP_CWD_SIZE'
char cwdName[ FTP_CWD_SIZE ]; // name of current directory
^~~~~~~~~~~~
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:58:22: error: 'FF_MAX_LFN' was not declared in this scope
#define FTP_CWD_SIZE FF_MAX_LFN+8 // max size of a directory name
^
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:137:22: note: in expansion of macro 'FTP_CWD_SIZE'
char rnfrName[ FTP_CWD_SIZE ]; // name of file for RNFR command
^~~~~~~~~~~~
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:58:22: note: suggested alternative: 'INTMAX_MIN'
#define FTP_CWD_SIZE FF_MAX_LFN+8 // max size of a directory name
^
C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:137:22: note: in expansion of macro 'FTP_CWD_SIZE'
char rnfrName[ FTP_CWD_SIZE ]; // name of file for RNFR command
^~~~~~~~~~~~
C:\Users\x-gio\Documents\Project\Geva\GEVINO Common\GEVINO_Example_Manual\GEVINO_Opto_NPN\FtpServer\FtpServer.ino: In function 'void setup()':
FtpServer:75:9: error: 'FAT_FS' was not declared in this scope
if( ! FAT_FS.begin( CS_SDCARD, SD_SCK_MHZ( 12 )))
^~~~~~
C:\Users\x-gio\Documents\Project\Geva\GEVINO Common\GEVINO_Example_Manual\GEVINO_Opto_NPN\FtpServer\FtpServer.ino:75:9: note: suggested alternative: 'FAT_USE'
if( ! FAT_FS.begin( CS_SDCARD, SD_SCK_MHZ( 12 )))
^~~~~~
FAT_USE
exit status 1
'FAT_FS' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hi giovera This morning I took out an arduino due from the bottom of my drawer, as well as a wiznet module. It has been two years since I compiled this library ... I just finish to compile FtpServerTest (the example)
You have done a great job. I would have thought that such a beautiful work was known and widely used.
I design cards, these: https://shop.gevaelettronica.it/en/3-arduino-compatible
I'm not very good with software.
I was wrong to remove this.
I'm trying to change SdFat, But I can not find where it is included.
To use FtpServerTest with SdFat. You have to install FatLib and SdFat in your library. Then, in file FatLib.h uncomment line 33 and comment line 34:
#define FAT_USE FAT_SDFAT
//#define FAT_USE FAT_FATFS
I guess you have to modify some defines according to your hardware I would like to know: -what is exactly your hardware? Your Arduino Zero is original from Arduino? , Adafruit?, an other clone? Your ethernet module is a wiznet5500. Your card reader?
Our messages crossed :-)
Impressed by your web site!
It all works perfectly, just the NAT does not work. I think it's the cause is router (Provided by the internet provider). Now I try different ports.
I would use SdFat because already use in other parts of the program. I think using the same LIB, will save space in RAM / Flash
Only now I see that the FatFS you made it. But it is 100% compatible and faser ad SdFat ? All function work same ?
FatLib is mainly a wrapper that allow you to write a program regardless of the library you will use to access the memory card or spiffs (with esp8266) For example, in case of FtpServer, you can switch from one library to an other without modifying a line of code. When possible, FatLib fonctions are direct calls to SdFat, so the speed is the same and the code size is almost equal. Look at the readme.md and the example. Unless you have a very specific use, you should not have a problem. If not, notify me
Additionally, I have included functions to handle file timestamps and to read strings and integer values in decimal and hexadecimal form. This can be interesting if you use files to configure your devices.
Buongiorno Sorry, my italian knowledge doesn't go much further :-). I am french and I lived a very long time in Venezuela. Now back in France, at Lyon. I investigated what appens with ftp server when accessing it from outside of the local net. First, it is necessary to redirect ports 21 and 55600 on the router to which the server is connected. Port 55600 is used by the server as the data port in passive mode. It is defined in FtpServer.h Under a Windows pc, Filezilla connect to server, but can not retrieve directory list. Opening data connection fails. Using FtpRush, it managed to open the connection but only after switching to active mode and taking a variable time. I think I found the reason: the server sends its own local ip address instead of the external ip address of the router. Please give me a moment to check this and see how to fix it.
Buongiorno anche a te.
My router does not open the port 21 I Believe That the provider uses it to do maintenance I moved to the 2121 port commands work, but does not list dir.
Even one of my friends said the same IP external/internal
I solved by finding a function, service mapping, in the router. Work active or passive.
But I do not know how many routers have such an intelligent function.
I'm working to make user and password, modifiable runtime, on RAM But there are many changes, I do not know if you put them in the folk
You have create FAT_FS. disk inside library. For not create new one i'm using your, but name is not good for this.
File = FAT_FS.open("in1_off.wav");
AudioZero.play(File);
Hi
My router does not open the port 21
Yes, it is possible to translate the port number in the rule you add in the router, or to configure the ftp server to use an other port.
I'm working to make user and password, modifiable runtime
Thank you for all your comments. They help me improve the library. Instead of modifying defines in FtpServer.h it will be better to have the oportunity to call functions inmain routine for configuring ports and credentials. I put it in my todo list.
FAT_FS usage: I am not sure to understand your example. Can you send me the code you would use with SdFat library?
byte mac [] = { 0xde , 0xad , 0xbe , 0xef , 0xfe , 0xef };
IPAddress serverIp( 0, 0, 0, 0 );
File File;
// SdFat SD;
FtpServer ftpSrv;
void setup()
{
initSD();
Ethernet.init(10);
delay(500);
if (Ethernet.linkStatus() == LinkON){
if( Ethernet.begin(mac) ){
SerialUSB.println("ETH OK");
ETH_USE = 1;
} else SerialUSB.println("ETH FAIL");
} else SerialUSB.println("ETH Link Off");
if(ETH_USE) ftpSrv.init();
}
void loop(){
if(ETH_USE){
newSt = ftpSrv.service();
if( newSt != oldSt ){
SerialUSB.print("Nuovo Stato ");
SerialUSB.println(newSt);
oldSt = newSt;
}
}
}
void initSD()
{
if (!FAT_FS.begin(SD_CS,SD_SCK_MHZ(12))) errorLed(0,0,1,"01-Inizializzazione SD fallita !");
if(FAT_FS.exists("firmware.bin")) FAT_FS.remove("firmware.bin");
File = FAT_FS.open("config.ini");
if( getFieldSD("enableSmsOn=") == "1" ) enableSmsOn = 1;
}
Can you replace File File; with FAT_FILE File;
And tell me the result.
Note: IMO, it is better practice to use different names for variables and their constructors. And that they don't begin with capitalized letter FAT_FILE file;
The authentication will not work anymore.
FtpServer.h
//#define FTP_USER "arduino" // User'name
//#define FTP_PASS "test" // His password
FtpServer.cpp
extern char *FTP_USER;
extern char *FTP_PASS;
.ino
char FTP_USER[15]; // FTP User'name
char FTP_PASS[15]; // FTP password
getFieldSD("FTPuser=").toCharArray(FTP_USER, sizeof(FTP_USER));
getFieldSD("FTPpassw=").toCharArray(FTP_PASS, sizeof(FTP_PASS));
SerialUSB.println(strlen(FTP_USER));
SerialUSB.print(FTP_USER);
SerialUSB.println(";");
The Debug are Ok, but using gevino, gevino not log in
6 gevino;
File File; is made of "Replace All" But Work, have not created problem. In any case I changed.
Hi I have resolved the access from the outside network. I have to clean the code and shall send it to you.
Good, perfect But the change on my fork ?
Hi I just update the repository of ftpServer. Please download it, update the library and read and try the two examples FtpServerTest and FtpServerStatusLed
In your code, do not modify the Serial but try the following Add this 4 lines at the beginning of your main code as explained there: [https://learn.adafruit.com/adafruit-feather-m0-basic-proto/adapting-sketches-to-m0]()
#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)
// Required for Serial on Zero based boards
#define Serial SERIAL_PORT_USBVIRTUAL
#endif
It depends of your hardware and I can not try it. Please tell me if this work. Now I have to update the discussion on the forum and give more details on these modifications Thank you for your patience
What is this code ? On my board exist. (All Working) SerialUSB Serial Serial1 Serial2 Serial3
Honestly, I have not investigated. Just now I make a search in the ide software::
Search "SERIAL_PORT_USBVIRTUAL" (74 hits in 11 files) D:\Arduino\arduino-1.8.13\examples\11.ArduinoISP\ArduinoISP\ArduinoISP.ino (2 hits) Line 133: #ifdef SERIAL_PORT_USBVIRTUAL Line 134: #define SERIAL SERIAL_PORT_USBVIRTUAL D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\circuitplay32u4\pins_arduino.h (3 hits) Line 353: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial Line 362: #define SERIAL_PORT_USBVIRTUAL Serial Line 367: #define SerialUSB SERIAL_PORT_USBVIRTUAL D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\ethernet\pins_arduino.h (1 hit) Line 243: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\leonardo\pins_arduino.h (3 hits) Line 375: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial Line 384: #define SERIAL_PORT_USBVIRTUAL Serial Line 389: #define SerialUSB SERIAL_PORT_USBVIRTUAL D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\mega\pins_arduino.h (1 hit) Line 396: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\robot_control\pins_arduino.h (2 hits) Line 314: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial Line 323: #define SERIAL_PORT_USBVIRTUAL Serial D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\robot_motor\pins_arduino.h (2 hits) Line 309: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial Line 318: #define SERIAL_PORT_USBVIRTUAL Serial D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\standard\pins_arduino.h (1 hit) Line 243: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial D:\Arduino\arduino-1.8.13\hardware\arduino\avr\variants\yun\pins_arduino.h (1 hit) Line 32: // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial D:\Arduino\arduino-1.8.13\libraries\Bridge\examples\YunFirstConfig\YunFirstConfig.ino (50 hits) Line 30: SERIAL_PORT_USBVIRTUAL.begin(9600); // initialize serial communication Line 31: while (!SERIAL_PORT_USBVIRTUAL); // do nothing until the serial monitor is opened Line 33: SERIAL_PORT_USBVIRTUAL.println(F("Hi! Nice to see you!"));
It depends on the hardware. It will not hurt to try. I think you can also try by replacing SERIAL_PORT_USBVIRTUAL by SerialUSB
Nothing works, only the yellow LED works.
This example: ` **#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL) // Required for Serial on Zero based boards
#define FAT_USE FAT_SDFAT
// Define Chip Select for your SD card according to hardware
// Define Reset pin for W5200 or W5500 // set to -1 for other ethernet chip or if Arduino reset board is used
// Define pin for led
//#define LED_PIN 5
FtpServer ftpSrv;
// Mac address of ethernet adapter // byte mac[] = { 0x90, 0xa2, 0xda, 0x00, 0x00, 0x00 }; // byte mac[] = { 0x00, 0xaa, 0xbb, 0xcc, 0xde, 0xef }; byte mac[] = { 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xef };
// IP address of FTP server // if set to 0, use DHCP for the routeur to assign IP // IPAddress serverIp( 192, 168, 1, 40 ); IPAddress serverIp( 0, 0, 0, 0 );
// External IP address of FTP server // In passive mode, when accessing the serveur from outside his subnet, it can // be necessary with some clients to reply them with the server's external // ip address // IPAddress externalIp( 192, 168, 1, 2 ); IPAddress externalIp( 0, 0, 0, 0 );
/***
INITIALISATION
***/
void setup() { SerialUSB.begin( 115200 ); while(!SerialUSB); SerialUSB << F( "=== FTP Server state Led ===" ) << eol;
// initialize digital pin LED_PIN as an output. pinMode( LED_PIN, OUTPUT ); // turn the LED off digitalWrite( LED_PIN, LOW );
// If other chips are connected to SPI bus, set to high the pin connected to their CS // pinMode( 4, OUTPUT ); // digitalWrite( 4, HIGH );
// Initialize the SD card. SerialUSB << F("Mount the SD card with library ");
SerialUSB << F("SdFat ... ");
SerialUSB << F("FatFs ... ");
if( ! FAT_FS.begin( CS_SDCARD, SD_SCK_MHZ( 12 ))) { SerialUSB << F("Unable to mount SD card") << eol; while( true ) ; } pinMode( CS_SDCARD, OUTPUT ); digitalWrite( CS_SDCARD, HIGH ); SerialUSB << F("ok") << eol;
// Send reset to Ethernet module if( P_RESET > -1 ) { pinMode( P_RESET, OUTPUT ); digitalWrite( P_RESET, LOW ); delay( 200 ); digitalWrite( P_RESET, HIGH ); delay( 200 ); }
// Initialize the network SerialUSB << F("Initialize ethernet module ... "); if( serverIp[0] != 0 ) Ethernet.begin( mac, serverIp ); else if( Ethernet.begin( mac ) == 0 ) { SerialUSB << F("failed!") << eol; while( true ) ; } SerialUSB << F("ok") << eol;
serverIp = Ethernet.localIP(); SerialUSB.print("IP address of server: "); SerialUSB.print(serverIp[0]); SerialUSB.print("."); SerialUSB.print(serverIp[1]); SerialUSB.print("."); SerialUSB.print(serverIp[2]); SerialUSB.print("."); SerialUSB.print(serverIp[3]);
// Initialize the FTP server ftpSrv.init(); }
/***
MAIN LOOP
***/
void loop() { uint8_t status = ftpSrv.service(); if(( status & 0x07 ) <= 2 ) // server waiting a client connection digitalWrite( LED_PIN, LOW ); else // client digitalWrite( LED_PIN, HIGH );
// more processes... }`
This message on consolle:
=== FTP Server state Led === Mount the SD card with library SdFat ... ok Initialize ethernet module ... ok IP address of server: 192.168.1.70
This FTP message: Status: Disconnected from server Status: Connecting to 192.168.1.70:21... Status: Connection established, waiting for welcome message... Status: Plain FTP is insecure. Please switch to FTP over TLS. Command: USER arduino Response: 331 Ok. Password required Command: PASS **** Error: Connection timed out after 20 seconds of inactivity Error: Could not connect to server Status: Waiting to retry... Status: Connecting to 192.168.1.70:21... Status: Connection established, waiting for welcome message... Error: Connection timed out after 20 seconds of inactivity Error: Could not connect to server
Looks like the server hangs.
Please, remove this 4 lines and replace them simply with
#define Serial SerialUSB
Cannot Boot exist. Serial and SerialUSB Cannot be overwritted.
On my Folk i have used SerialTest on the code. And define
Replacing all Serial with SerialUSB, now consolle is:
=== FTP Server state Led === Mount the SD card with library SdFat ... ok Initialize ethernet module ... ok IP address of server: 192.168.1.70 Command: 1 Transfer: 0 Data: 0 Ftp server waiting for connection on port 21 Command: 2 Transfer: 0 Data: 0 Client 'arduino' connected! Command: 3 Transfer: 0 Data: 0 USER arduino Command: 4 Transfer: 0 Data: 0 PASS test Authentication Ok. Waiting for commands. Command: 5 Transfer: 0 Data: 0 SYST FEAT PWD TYPE I PASV Connection management set to passive Listening at 192.168.1.70:55600 MLSD Command: 5 Transfer: 5 Data: 17 Command: 5 Transfer: 0 Data: 0
And FreeZilla is:
Status: Disconnected from server Status: Connecting to 192.168.1.70:21... Status: Connection established, waiting for welcome message... Status: Plain FTP is insecure. Please switch to FTP over TLS. Status: Server does not support non-ASCII characters. Status: Logged in Status: Retrieving directory listing... Status: Directory listing of "/" successful
There are not Welcome message. But now list file work
I do not understand why with Serial the file list does not work
Welcome is there only when auth fail.
Status: Connecting to 192.168.1.72:2121... Status: Connection established, waiting for welcome message... Response: 220--- Welcome to FTP for Arduino --- Response: 220--- By Jean-Michel Gallego --- Response: 220 -- Version 2020-10-08 -- Status: Plain FTP is insecure. Please switch to FTP over TLS. Command: USER arduino Response: 530 Error: Could not connect to server Status: Disconnected from server Status: Connecting to 192.168.1.72:2121... Status: Connection established, waiting for welcome message... Status: Plain FTP is insecure. Please switch to FTP over TLS. Status: Server does not support non-ASCII characters. Status: Logged in Status: Retrieving directory listing... Status: Directory listing of "/" successful
Yes, it looks like FileZilla don't show the same information when connecting to a server on an outer network. May be a security measure? I am probing with FileZilla and ftpRush. They don't react always in the same way! I see than you configure FileZilla to use port 2121. Did you modify #define FTP_CTRL_PORT 21 in FtpServer.h or did you configure the router to make the transfer?
I am reading about Due specification. The board also as a native usb port.
I suppose you use the arduino ide. Can you tell me wich board you select in the ide?
Arduino zero, native USB port Need to be install ARM compiler.
I have set 2121 boot, on define and on filezilla. My router do not open 21 port, is busy.
This message (welcome) is locally, not external ip.
Using external ip, now list dir work well
What is the problem, this change crash all ?
FtpServer.cpp extern char FTP_USER; extern char FTP_PASS;
.ino char FTPUSER[15] = "arduino" char FTPPASS[15] = "password"
Now you can set username and password in your code without modifying the library. In repository that I upload yesterday, please have a look at the updated example FtpServerTest, line 118
Grazie Now my project is complete and it works well. Missing only the Welcome, you can not fix it? I put your library and example on the GEVINO document/examples
Can you change to const char ? ftpSrv.credentials(const char, const char* )
String.c_str() return const char pointer ftpSrv.credentials( (char)getFieldSD("FTPuser=").c_str(), (char*)getFieldSD("FTPpassw=").c_str() );
Can you add port to ftpSrv.credentials, or make new function for it ?
Maybe your FTP can work with Telnet server ? https://gist.github.com/atomsfat/1813823
There are not library for esy make telnet server,if you have time for make it.
Hi Glad to know that your project is working! There are several points in your last message. I will try to answer all.
Missing only the Welcome
I do not understand. Wich welcome and where?
Can you change to const char* ?
Yes, I did it in the last update. I am thinking of upload it today. But this time, I am thinking to better checkevery thing first. These days I had uploaded the changes too quickly in hopes of resolving your remarks and this led to somes errors on my part.
Maybe your FTP can work with Telnet server ?
Yes, they are independent services and can work in parallel. W5500 has enough sockets for that. You just have to make sure that the different services are non blocking.
It depends on the filezilla configuration, not the server
Be sure to check this box before connecting to the server.
Or try FTP Rush. It less complicated. And you too can edit files on the server :-)
yes Same problem accessing on Linux FTP server.
Thank you to confirm! Protocol for FTP has evolutionned in the time and each client or server has his own particularities and do not always respect perfectly the protocol. So it is a good practice to make test with different clients and servers as you do and as I do myself. This afternoon I have uploaded some changes and I hope than they are definitives, at least for the moment... In particular, I believe that example FtpServerTestSerialUsb will be of interest for you.
On the other hand, if you don't want to rewite the complete code, I suggest you to see the four lines I add in FtpServer.cpp
Replace line 229
client.stop();
with
if( client )
client.stop();
if( data )
data.stop();
The reason is that sometime, when my friend FileZilla does not finish correctly a transaction, the server was not closing the corresponding socket. After several fails, all sockets are in use and server crash.
Very Good.
I can upload firmware via FTP now. When client close the connection, if there is a file "firmware.bin" on SD, I reboot the micro and updating firmware.
You have not added way for change port Runtime ? It is not essential, but cute.
HI
I'm trying Arduino Zero SAMD21 CPU
But when I try to download a file with FtpZilla, I get this error. After that no longer connects.