Project - Stable FTP Server

I just posted Stable FTP Server on Codeshare. Feel free to discuss and make suggestions here.

7 Likes

Very cool. What board was this designed to run on?

The FTPServer dll does not have any GHI dependencies, so it should run on any NETMF board which supports TCP via sockets.

The test app uses some GHI Premium libs for SD Card and Network init.
I have tested it on a G120 based board with ENC28 Network.

Basically if the FTP Server from the Framework runs on your board, my modified version should run as well.

@ Reinhard Ostermeier -

Stable FTP - SFTP? :wink:

@ Architect - no. Its more like the Home of ā€œFrei Trabende Pferdeā€ (Free Running Horses) :smiley:
Or is this stable spelled differently?

Thanks for the upload Reinhard! I was having trouble sending 1MB files with the .NETMF FTP Server. Sometimes theyā€™d work. Sometimes, theyā€™d get truncated. This implementation seems to work all of the time.

Do you have any plans to add these changes to the .NETMF Codeplex projects?

Nice to see itā€™s of some help for you.
The issue with big files was that there was a general timeout. If after a fixed time there were no new FTP requests, the connection was closed. A file transfer was not recognized there. I simply reset the timeout with every data package.

About adding it to codeplex:
If I have it right in mind the project structure is a bit ā€˜wiredā€™. And since it would only really come active with the next release of NETMF, It might be work that no one helps atm.

I was curious if the transfer rate Iā€™m getting is typicalā€¦ Iā€™m running the FTP Server code on a FEZ Cobra II (NET). It takes about 350 seconds to send 1 MB; FTP tells me Iā€™m getting about 3 KB/Sec. (Using FtpFileSystemListener)

I tried adjusting the default buffer size inside of FtpResponseStream - increased it from 512 to 4096; but that adjustment seemed to cause my transfer to terminate unexpectedly. I also noticed thereā€™s a thread.sleep in the ReadTo method; the sleep value is only 1 msec. Is that sleep necessary?

Any other thoughts on speeding up the upload rate?

Thanks

Not sure why there is a sleep(1), may be to not block the whole system there.

I found that the limiting factor seams to be the writing to SD card.
Thatā€™s why I created the VirtualListener which stores everything in memory. This way faster, but after shutdown the data is lost.
That was no problem for my application, because it only sends commands via FTP file transfer (Eromap63).

Hello I am also using this code for my project and transfert rate is quite slow. I have try to modify the sleep duration but this does not seem to enhance results. Any other idea?

@ leforban - Do you read/write from/to SD card?
This was very slow for me too.
You can try the virtual file system that I have included.
By this you should see which rate the FTP implementation can provide.

Yes I am using SD card. I will see how to use the virtual file system. Should I transfert first the file from SD to the virtual file system first?

If the combination FTP + SD is what makes it slow, then this might bring an advatage.
The virtual file System has Events when files are created and closed.

Ok hereā€™s the results on 3MB file on EMX:

-for SD file system: put= 17kB/s get=19kB/s.
-for Virtual file system: put=18.8kB/s get=19.56kB/s

???

This does not seem to be the SD card that limits the throughputā€¦ however the ftpserver runs with a tons of other thingā€¦ I will try to dive into this soon

@ leforban - I took the code base from the NETMF Framework, and tried to tweak it until it was stable.
At the end I was thinking a reimplementation would have been better.
Some parts are a bit messy and not that easy to understand.

Let me know if you find something.

Did you try if the FTP Server from the Framework has a better throughput?

No I didnā€™t try the code from NETMF. I donā€™t know if itā€™s better or not. In my application reliability is essential.

I started to go deeper into the code and to be honest thereā€™s some tricky partsā€¦ and donā€™t know what can be modified to enhance results.

However something that surprises me is to have about zero improvement when using the virtual filesystemā€¦

@ leforban - Yes, thatā€™s kind of strange. I had a Major improvement on G120 + ENC28 with FW 4.2.11 if I remember correctly.
Iā€™ll check if I can find the data streaming part.
Also: there is an active and an passive mode for data transfer.
The client decides which one is used.
Not sure what was used in my project (If I remember correctly it was the one that is not recommended anymore nowadays)
Dependent on that mode the TCP server/client roles are swapped.

I am not sure how active passive mode works now. I thought by default active mode is enable.

Active mode: the client initiate the tcp session on port 21. Once the session is established the serveur start an other tcp connection usually with source port 20 and a dynamic destination port on the client.

If passive mode is enabled, as the active mode, the client start a tcp session ofn port 21 but the server wait for a other TCP connection with PASV command. then the client establish a second session on a dynmic port of the serverā€¦

Anyway this should not impact the bandwidth unless a firewall or network management unit limits the bandwith with some port restriction.

@ leforban - The difference between active and passive mode might be the implementation in the FTP server.
Not sure if itā€™s different, but Iā€™ll see if I find it tomorrow.

@ leforban - One question to compare it with the speed of my bluetooth file transfer. Do you mean 18 KiloBytes/sec or 18 Kilobits/sec? Whatā€™s the transfer time for the 3 MByte file?
Cheers
Roland