This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FTP server get or put commands do not work

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

Parents
  • 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

Reply
  • 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

Children