FTP server and the FTP client sample code
FTP server and the FTP client sample code
Hello,
I have been trying to make integrate an update command into my program, basically by merging the FTP Client and SD Update example, so that I can pull updates from a server and store multiple versions on SD card.
An issue which I have encountered is that the FTP Client sample cannot connect to my FireZilla server, even though I changed the parameters to match my servers user. When I looked at a serial output, it returner error -4, which was either FTP_COMMANDFAIL or FTP_COMMANDERROR, and noticed that the server displayed an error "425 Can't open data connection". All the firewalls are off and this is done on the local network so I do not think the router is an issue, even though I set the forwarding up anyways. Does anyone have an idea as to what may be wrong?
Thank you.
I have been trying to make integrate an update command into my program, basically by merging the FTP Client and SD Update example, so that I can pull updates from a server and store multiple versions on SD card.
An issue which I have encountered is that the FTP Client sample cannot connect to my FireZilla server, even though I changed the parameters to match my servers user. When I looked at a serial output, it returner error -4, which was either FTP_COMMANDFAIL or FTP_COMMANDERROR, and noticed that the server displayed an error "425 Can't open data connection". All the firewalls are off and this is done on the local network so I do not think the router is an issue, even though I set the forwarding up anyways. Does anyone have an idea as to what may be wrong?
Thank you.
Re: FTP server and the FTP client sample code
Many FTP systems won't work across a firewall unless you use the passive mode....
IE
call
/*Set FTP in Passive mode for better Firewall behavior*/
void FTPPassiveMode( int ftp_Session );
on the Ftp session before trying to send /rx data.
IE
call
/*Set FTP in Passive mode for better Firewall behavior*/
void FTPPassiveMode( int ftp_Session );
on the Ftp session before trying to send /rx data.
Re: FTP server and the FTP client sample code
Thank you very much, this has fixed the issue, although I am confused as to how it fixed it. You said that passive mode works better with firewalls, but I did a few tests with the firewall off and it still failed, weird.
Re: FTP server and the FTP client sample code
There are likely more firewalls and routers between here and there than you realize.
Re: FTP server and the FTP client sample code
Is there any particular reason why the FTPGetFile works for file sizes up to about 64kb, but when I attempt to transfer an update file 460kb big, I get a "426 Connection Closed" error?
Re: FTP server and the FTP client sample code
That function just returns a file descrptor... something else must actually read the file...
Whatever that code is is probably not handling the large file and closing down early...
Paul
Whatever that code is is probably not handling the large file and closing down early...
Paul
Re: FTP server and the FTP client sample code
I am also getting error code 425, but only after I have performed a certain number of sequential ftp sessions. It seems that once I enter passive mode with FTPDSess.nSession equal to 27, when I try to retrieve a file, I get the following responses:
150 File status okay; about to open data connection
425 Can't open data connection.
From then on I'm hosed. My command interface works, but the data connections fail.
I'm going to try running in active mode to see if it's just passive mode causing problems. I'm guessing it has something to do with the listener sockets.
150 File status okay; about to open data connection
425 Can't open data connection.
From then on I'm hosed. My command interface works, but the data connections fail.
I'm going to try running in active mode to see if it's just passive mode causing problems. I'm guessing it has something to do with the listener sockets.
Re: FTP server and the FTP client sample code
***** UPDATE *******
I ran the Auto FTP Manager application overnight using ACTIVE FTP mode and had it pull off generated files from my SD card every two minutes. Everything worked fine, so the problem appears to be related to operation in passive mode. This seems like it would be a problem in the Netburner system library. If anyone has run into this issue, or has NOT run into this issue when performing repeated FTP client sessions to the Netburner server, I would be interested in hearing of your experience.
I ran the Auto FTP Manager application overnight using ACTIVE FTP mode and had it pull off generated files from my SD card every two minutes. Everything worked fine, so the problem appears to be related to operation in passive mode. This seems like it would be a problem in the Netburner system library. If anyone has run into this issue, or has NOT run into this issue when performing repeated FTP client sessions to the Netburner server, I would be interested in hearing of your experience.
Re: FTP server and the FTP client sample code
There was an issue that has been fixed with the FTP server examples where an abnormal data socket closure would cause the server to not be able to transfer data. This sounds like what you're seeing. What version of the NNDK is your code from?
-Dan
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: FTP server and the FTP client sample code
I was at 2.6. I just purchased a renewal to try updating to 2.7 to see if this issue goes away, but I've been having a lot of issues with the update (see the NNDK update announcement), and haven't gotten back to a buildable app yet. It actually seems to me like it's running out of sockets or some limited resource, becaause it works fine for a number of sessions, but fails after the PASV command response returns a value of 100,27 as the last two octets, 27 being the number that Netburner library appears to auto-increment every time a PASV command is issued.