Comments (79)
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
from arduino-ftp-server.
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
from arduino-ftp-server.
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.
from arduino-ftp-server.
Then you made Change on the library and i test for you ?
Add also
#define SerialTest Serial // SerialUSB
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.
from arduino-ftp-server.
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
from arduino-ftp-server.
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
from arduino-ftp-server.
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
#define FTP_DATA_PORT_PASV 19
To open the 19-20-21
But also no longer it works locally.
from arduino-ftp-server.
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
from arduino-ftp-server.
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.
from arduino-ftp-server.
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?
from arduino-ftp-server.
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.
from arduino-ftp-server.
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
from arduino-ftp-server.
Haaa, ok, folk, fork
No, is not my project.
Is your project, with change that you have proposed.
And small other.
from arduino-ftp-server.
I'm trying to use SdFat
on .ino
#define FAT_USE FAT_SDFAT
on ftpServer.h
#include <SdFat.h>
instead of
#include <FatLib.h>
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.
from arduino-ftp-server.
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)
from arduino-ftp-server.
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.
#include <FatLib.h>
I'm trying to change SdFat, But I can not find where it is included.
from arduino-ftp-server.
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?
from arduino-ftp-server.
Our messages crossed :-)
from arduino-ftp-server.
Impressed by your web site!
from arduino-ftp-server.
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 ?
from arduino-ftp-server.
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.
from arduino-ftp-server.
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.
from arduino-ftp-server.
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);
from arduino-ftp-server.
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?
from arduino-ftp-server.
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;
}
from arduino-ftp-server.
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;
from arduino-ftp-server.
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;
from arduino-ftp-server.
File File; is made of "Replace All"
But Work, have not created problem.
In any case I changed.
from arduino-ftp-server.
Hi
I have resolved the access from the outside network.
I have to clean the code and shall send it to you.
from arduino-ftp-server.
Good, perfect
But the change on my fork ?
from arduino-ftp-server.
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
from arduino-ftp-server.
What is this code ?
On my board exist. (All Working)
SerialUSB
Serial
Serial1
Serial2
Serial3
from arduino-ftp-server.
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
from arduino-ftp-server.
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 Serial SERIAL_PORT_USBVIRTUAL
#endif
#define FAT_USE FAT_SDFAT
#include <FtpServer.h>
// Define Chip Select for your SD card according to hardware
#define CS_SDCARD 12 // Chip Select for SD card reader on Due
// Define Reset pin for W5200 or W5500
// set to -1 for other ethernet chip or if Arduino reset board is used
#define P_RESET 11
// Define pin for led
#define LED_PIN LED_BUILTIN
//#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 ");
#if FAT_USE == FAT_SDFAT
SerialUSB << F("SdFat ... ");
#else
SerialUSB << F("FatFs ... ");
#endif
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
from arduino-ftp-server.
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
from arduino-ftp-server.
Looks like the server hangs.
Please, remove this 4 lines and replace them simply with
#define Serial SerialUSB
from arduino-ftp-server.
Cannot
Boot exist. Serial and SerialUSB
Cannot be overwritted.
On my Folk i have used
SerialTest on the code.
And define
#define SerialTest SerialUSB
#define SerialTest Serial
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
from arduino-ftp-server.
Welcome is there only when auth fail.
from arduino-ftp-server.
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
from arduino-ftp-server.
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?
from arduino-ftp-server.
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?
from arduino-ftp-server.
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
from arduino-ftp-server.
What is the problem, this change crash all ?
FtpServer.cpp
extern char* FTP_USER;
extern char* FTP_PASS;
.ino
char FTP_USER_[15] = "arduino"
char FTP_PASS_[15] = "password"
from arduino-ftp-server.
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
from arduino-ftp-server.
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.
from arduino-ftp-server.
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.
from arduino-ftp-server.
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 :-)
from arduino-ftp-server.
yes
Same problem accessing on Linux FTP server.
from arduino-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.
from arduino-ftp-server.
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.
from arduino-ftp-server.
I have downloaded FTP Rush
But i don't find way for edit config.ini, text file, directly inside Client.
from arduino-ftp-server.
Right click on the file open this menu:
from arduino-ftp-server.
My FTP RUSH is different.
from arduino-ftp-server.
I now realize that the version of FtpRush I am using is very, very old !
What a shame!
from arduino-ftp-server.
from arduino-ftp-server.
Exist V2 and V3.
But FileZilla Work well.
from arduino-ftp-server.
Ok,
I tried the V2 but is a continuous crash.
Do not download files.
Just reopened FileZilla has downloaded them.
from arduino-ftp-server.
Ja ja ja. Using a software 9 years old. May be I should update it...
change port Runtime
Yes, it would be nice something like:
ftpSrv.init( commandPort, dataPort, externalIP );
but, until now I do not know how to instantiate a server object without define his port number.
So, the only solution at the moment is to modify the #define in FtpServer.h
I have updated the discussion in the forum and thank you for your suggestions
from arduino-ftp-server.
Hi
I updated to the version V2.2.0 from FtpRush. Looks like V3 is beta
It is working fine here.
But if you are satisfied with FileZilla, that is all right.
Something we do not discute:
If the client crashes without closing the connection (for example if the computer it is running on loses its connecttion to the internet), the server does not close immediately (because it has no way to know about the crash).
Consequently, you can't reconnect until the server closes the connection.
This time lapse is defined by FTP_TIME_OUT in FtspServer.h and I set it to 5 minutes. But you can reduce it if you will.
from arduino-ftp-server.
Thank you.
I already switched to another project, but I would still experience here.
For example, I wanted to see if it was possible to enable uPnP
The problem is that opening the port is difficult and not very functional.
It works very well open the FTP service but do not know if uPnP can do this.
from arduino-ftp-server.
I have no experience with uPnP.
if I am not mistaken, the interest is to facilitate the configuration of the router behind which is connected a device (for example, your Gevino Zero)?
I have a question: You told me you are updating the firmware from a file uploaded to the SD.
This is interesting. Can you tell me which library you use for that?
from arduino-ftp-server.
I have created custom bootloader for SAMD21, but need hardware programmer.
Atmel-ice
from arduino-ftp-server.
Hi
Library work well, but IDE at startup says ?
"Invalid library found in C:\Users\x-gio\Documents\Arduino\libraries\FtpServer: no headers files (.h) found in C:\Users\x-gio\Documents\Arduino\libraries\FtpServer"
from arduino-ftp-server.
Hi
This is strange!
This message appears compiling one of the examples? Which one?
The editor points to a specific line?
from arduino-ftp-server.
Not, when ide start.
At startup it check all folder
from arduino-ftp-server.
All your libraries are in that folder?
My Users...\Documents\Arduino\libraries folder is empty. It only contains a file readme.txt
I have a libraries subfolder in the folder where are my sketches.
from arduino-ftp-server.
Maybe cause is missing file "library.properties" on my folder.
I'm going crazy.
Is there a conflict with the library https://github.com/stevemarple/IniFile
It was better if the file was opened in schetch and passed only the pointer to your library.
Problem is redefinition of "sd"
#define FAT_FS sd
line 43 FatLib.h
Also IniFile use same.
I can not understand what files you use sd
from arduino-ftp-server.
Arduino: 1.8.13 (Windows 10), Board: "GEVINO SD bootloader"
In file included from C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:38:0,
from C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\GEVINO_alarm\GEVINO_alarm.ino:43:
C:\Users\x-gio\Documents\Arduino\libraries\FatLib\src/FatLib.h:43:22: error: conflicting declaration 'SdFat sd'
#define FAT_FS sd
^
C:\Users\x-gio\Documents\Arduino\libraries\IniFile\src/IniFile.h:12:14: note: in expansion of macro 'FAT_FS'
extern SdFat FAT_FS;
^~~~~~
In file included from C:\Users\x-gio\Documents\Arduino\libraries\FatLib\src/FatLib.h:41:0,
from C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:38,
from C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\GEVINO_alarm\GEVINO_alarm.ino:43:
C:\Users\x-gio\Documents\Arduino\libraries\FatLib\src/ExtSdFat.h:26:17: note: previous declaration as 'ExtSdFat sd'
extern ExtSdFat sd;
^~
exit status 1
Error compiling for board GEVINO SD bootloader.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
from arduino-ftp-server.
Hi
It is difficult to answer you without your seeing the code.
If the error goes away when you delete the Inifile library, then yes there is a conflict between the libraries.
I do not know IniFile. I just see that in IniFile.h there is a way to select library to access SD card.
Maybe you can modify this library to use FatLib, the same way I do in ftp server.
This way you will be able to choose between SdFat or FatFs by simply changing a #define in your entire sketch.
from arduino-ftp-server.
Code is simple.
#include <SdFat.h>
#include <FtpServer.h>
#include <IniFile.h>
FtpServer ftpSrv;
IniFile ini("config.ini");
void setup(){}
void loop(){}
I'm trying to change the IniFile library but all attempts have failed.
You have too many recursive libraries and I lose myself.
Help me to find right definition for
extern SdFat sd;
Line 12 of
https://github.com/stevemarple/IniFile/blob/master/src/IniFile.h
from arduino-ftp-server.
Now Work
Sorry
Forget everything
from arduino-ftp-server.
Do not worry.
I don't know a way to progress without making mistakes!
Is IniFile used in setup() to configure some parameters? In that case may be you can do it in a simpler way.
from arduino-ftp-server.
I'm desperate, I can not find a solution for use this ibrary wit IniFile
Can you help me ?
I always get "not open file".
#if defined(PREFER_SDFAT_LIBRARY)
#include "SdFat.h"
//extern SdFat SD;
extern SdFat sd;
#else
bool IniFile::open(void)
{
if (_file)
_file.close();
// _file = SD.open(_filename, _mode);
_file = sd.open(_filename, _mode);
if (isOpen()) {
_error = errorNoError;
return true;
}
else {
_error = errorFileNotFound;
return false;
}
}
from arduino-ftp-server.
Hi
Let me see if I have time this afternoon to help you
from arduino-ftp-server.
Maybe I have solved problem
Tomorrow I continue
.ino
#include <SdFat.h>
SdFat SD;
IniFile.h
#if defined(PREFER_SDFAT_LIBRARY)
#include "SdFat.h"
extern SdFat SD;
from arduino-ftp-server.
nothing, now works IniFIle but not works FTP
Only i see directory, but not work uplaod download file.
I need your help for setup disk.
"SD" "sd" "FAT_LIB"
Where and what extern define.
from arduino-ftp-server.
Not, now work
from arduino-ftp-server.
#if defined(PREFER_SDFAT_LIBRARY)
#include "ExtSdFat.h"
extern ExtSdFat sd;
#else
#include "SD.h"
#endif
from arduino-ftp-server.
Maybe you have not undestand.
I have to use same disk (sdfat) from IniFile and FTPserver
If I use config above, build work, but somtime i found SD brocken.
Also formatting is impossible, i have removed and recreated partition for save it.
from arduino-ftp-server.
Related Issues (8)
- Teensy 3.6 HOT 1
- Questions & Date Addition to code
- how get it to work on ENC28J60 HOT 1
- what is the limit of file that can be stored on SDcard using this library? i.e. largest file that be downloaded from internet to the SDcard.
- Status: Connecting to 192.168.1.72:2121...
- Teensy 3.2 with Audio
- Support Teensy 4.1 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-ftp-server.