I’ve implemented the HTTP and FTP server using the MDK4.03 and RL-ARM 4.05 in a system based on LPC2468. The system makes use of a flash file system implemented in an SPI flash memory. The HTTP implementation works fine I can download and upload files to/from the file system on the device. When I tried the FTP server using the Windows command line FTP client utility I can connect to the FTP server, I can get a directory of the file system but I cannot get the files from the embedded file system. What is very strange is that I use the “mget *” command and the utility asks me if I want to get “file1” and I answer ‘y’ but then it says “File Not Found” and the same happens for the other files that were previously stored via the web interface. If I try to use the "put" command the Windows command line FTP client utility accepts the command but does not do anything. I used another FTP client app, the one from Total Commander and with it I can “put” files into the device but I cannot get them back. Besides Total Commander adds a “\” at the beginning of the file name. In the “NetConfig.c” I setup 10 TCP sockets, 4 to serve 4 HTTP sessions and 6 for 3 FTP sessions (I read in the TCPnet docs that the FTP server uses 2 sockets per session). I checked with Wireshark what is happening, I see the commands being sent and the responses coming from the embedded device so the TCP side is working. I noticed that the FTP server uses port 21 for command and ports starting with 1025 for data.
What I do not understand is why do I get the “”File Not Found” on get when a “dir” shows the file is there. Where should I look to find the problem? The “FTP_uic.c” is included in the project, the FTP file system access functions are very similar to the ones from the “HTTP_uic.c” .
Any pointer towards solving this problem will be greatly appreciated.
Many thanks, Doru
Try with the newer RL-ARM version: 4.13
Hi,
I finally got the chance to update to RL-ARM to 4.13 and although there is a small improvement, which is that the "put" command works with the Windows FTP client, the "get" operation still does not work. Also the FTP module adds a ‘\’ character in front of the file name while a file created from within the device via the fopen() function does not add any extra characters to the file name.
Moreover using the version 4.13 of RL-AM (we still use MDK 4.05) the HTTP stopped working. During the first HTTP access the web browser is able to get the index.htm file which points the browser to request the home.cgi file but the device web server responds with “404 Error. File Not Found”.
Were there changes in the fcarm.exe utility that would make the HTTP server unable to find the files from the ROM file system?
I’ve seen other posts that FTP works well in both directions so I assume that the feature should work fine but the fact that the files are seen by the “dir” command but not by the “get” indicate either a bug or incorrect configuration.
I get to answer one of my questions, with RL-ARM 4.13 there is a new version of FCARM (2.29), initially I thought that is the same as the one from RL-ARM 4.05 because the files have the same size. Using the new version of the FCARM the HTTP works properly but the FTP "get" or "mget" commands are still not working.
The FTP session looks like the following:
C:\fping>ftp 192.168.0.1 Connected to 192.168.0.1. 220 Keil FTP service User (192.168.0.1:(none)): FTP 331 Password required Password: 230 User logged in ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 8230 \__config_399901.bin 226 Transfer complete ftp: 113 bytes received in 0.34Seconds 0.33Kbytes/sec. ftp> put fping216.zip 200 Command successful 150 Opening data connection 226 Transfer complete ftp: 53250 bytes sent in 0.00Seconds 53250000.00Kbytes/sec. ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 8230 \__config_399901.bin 01-01-80 12:00PM 53250 \fping216.zip 226 Transfer complete ftp: 167 bytes received in 0.48Seconds 0.35Kbytes/sec. ftp> mget * 200 Command successful mget eCLRImg.img? y 200 Command successful 550 File not found mget \__config_399901.bin? y 200 Command successful 550 File not found mget \fping216.zip? y 200 Command successful 550 File not found ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 8230 \__config_399901.bin 01-01-80 12:00PM 53250 \fping216.zip 226 Transfer complete ftp: 167 bytes received in 0.44Seconds 0.38Kbytes/sec. ftp> bye C:\fping>
So I am still looking for help in solving the FTP get issue.
Thanks, Doru
I noticed another oddity of the FTP server behavior in my system.
I tried 3 different FTP client programs: Windows command line FTP client, FileZilla and Total Commander. When I open the FTP connection using Total Commander it displays the root folder as “/\/*.*”. The other clients show the root folder as “/”.
This points to problems in handling the root folder path due to differences between UNIX and Windows path styles.
In order to get more info about the problem I tried the following tests.
1. I created a sub-folder and “put” a file in the sub-folder. Then I renamed the file and the operation worked but the renamed file was placed in the root. I then tried to rename a file from the root and the operation failed.
C:\fping>ftp 192.168.0.1 Connected to 192.168.0.1. 220 Keil FTP service User (192.168.0.1:(none)): FTP 331 Password required Password: 230 User logged in ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 226 Transfer complete ftp: 52 bytes received in 0.17Seconds 0.30Kbytes/sec. ftp> pwd 257 "/" is the current directory ftp> mkdir folder 250 File command completed ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 226 Transfer complete ftp: 52 bytes received in 0.20Seconds 0.26Kbytes/sec. ftp> cd folder 257 "/folder" is the current directory ftp> pwd 257 "/folder" is the current directory ftp> put eCLRImg.img 200 Command successful 150 Opening data connection 226 Transfer complete ftp: 59076 bytes sent in 0.00Seconds 59076000.00Kbytes/sec. ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 59076 \folder\eCLRImg.img 226 Transfer complete ftp: 110 bytes received in 0.30Seconds 0.37Kbytes/sec. ftp> pwd 257 "/folder" is the current directory ftp> rename eCLRImg.img image.bin 350 Ready for destination name 250 File command completed ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 59076 image.bin 226 Transfer complete ftp: 102 bytes received in 0.31Seconds 0.33Kbytes/sec. ftp> rename image.bin test.bin 350 Ready for destination name 550 File not found ftp> bye 221 Goodbye C:\fping>
2. I created again a subfolder, did a ”put” operation and then a “get” and the “get” from the subfolder worked fine.
C:\fping>ftp 192.168.0.1 Connected to 192.168.0.1. 220 Keil FTP service User (192.168.0.1:(none)): FTP 331 Password required Password: 230 User logged in ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 59076 image.bin 226 Transfer complete ftp: 102 bytes received in 0.30Seconds 0.34Kbytes/sec. ftp> mkdir folder 250 File command completed ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 59076 image.bin 226 Transfer complete ftp: 102 bytes received in 0.33Seconds 0.31Kbytes/sec. ftp> cd folder 257 "/folder" is the current directory ftp> put eCLRImg.img 200 Command successful 150 Opening data connection 226 Transfer complete ftp: 59076 bytes sent in 0.00Seconds 59076000.00Kbytes/sec. ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 59076 image.bin 01-01-80 12:00PM 59076 \folder\eCLRImg.img 226 Transfer complete ftp: 162 bytes received in 0.39Seconds 0.42Kbytes/sec. ftp> pwd 257 "/folder" is the current directory ftp> get \folder\eCLRImg.img 200 Command successful 550 File not found ftp> get eCLRImg.img 200 Command successful 150 Opening data connection 226 Transfer complete ftp: 59076 bytes received in 2.86Seconds 20.66Kbytes/sec. ftp> dir 200 Command successful 150 Opening data connection 01-01-80 12:00PM 59076 eCLRImg.img 01-01-80 12:00PM 59076 image.bin 01-01-80 12:00PM 59076 \folder\eCLRImg.img 226 Transfer complete ftp: 162 bytes received in 0.42Seconds 0.38Kbytes/sec. ftp> bye 221 Goodbye C:\fping>
Did anyone observe similar issues and know how to avoid/solve?
Thanks and best regards, Doru
I have exactly the same problem. Any file I sent using Filezilla or using the C# FTP classes adds a "/" at the beginning of a the file. Apart from removing pre pending slashes in code, did you find a solution?
Hi Guys,
I have a very similar problems, im using LPC2378 / RL-ARM 4.12 and using FTP over File System in ROM i get the same error. The filesystem appear like corrupted, when i send a file the file appear with a anomalous "/". I can't create folder, anyone operation is avaliable. Can anyone give some light ?
Hi Friend,
I'm now in the same point that you...using UPLOAD and DOWNLOAD from HTTP is all right, so when i try use FTP...i have the "\" problem. Did you solve this in your application ?
Best Regards !
Fabio Boaretti
Hi Fabio,
I haven't solve that issue, I'm in the process of porting MDK_PRO 4.20 in this application. I will post the results when done.
Best regards, Doru
Hi Doru,
I believe that i solve the problem, i using 4.13 but i made some changes in the FTP_uif.c below the code changed for you test, in here now i able to do all operations over FTP runing in the RAM...take a look, was just the (fname+1)... below:
void *ftp_fopen (U8 *fname, U8 *mode) { /* Open file 'fname' for reading or writing. Return file handle. */ return (fopen ((const char *)fname+1, (const char *)mode)); } BOOL ftp_fdelete (U8 *fname) { /* Delete a file, return __TRUE on success. */ if (fdelete((char *)fname+1) == 0) { return (__TRUE); } return (__FALSE); } BOOL ftp_frename (U8 *fname, U8 *newn) { /* Rename a file, return __TRUE on success. */ if (frename((char *)fname+1, (char *)newn) == 0) { return (__TRUE); } return (__FALSE); }
Best Regards
Hi
could you give me example code for download file from http server. i can upload file to http server and with netCGI_ProcessData can handle input files data. But I don't know with which function in HTTP_Server_CGI.c could send data to browser.
thanks a lot