0 votes

Evaluating Ftp.dll:
When downloading a file sized exactlye 8192, 16384 (probably other 2^X sizes too), I consistently get the following exception:

Limilabs.FTP.Client.FtpResponseException: Requested action aborted: local error in processing. Transferred 0 bytes in 1436856489 seconds. 0KB/second.
at Limilabs.FTP.Client.Ftp.(Boolean )
at Limilabs.FTP.Client.Ftp.Download(String remotePath, Int64 remoteStartPosition, Stream destination)
at Limilabs.FTP.Client.Ftp.Download(String remotePath, String localPath)

1) the # of seconds is wrong (it's closer to 0 seconds).
2) Why always this exception? SOunds like a serious bug. Other ftp programs have no trouble. Smth with having the download size aligned with the buffer size?

by

1 Answer

+1 vote
 
Best answer

This error is raised by your FTP server, not Ftp.dll.

FtpResponseException exception type is thrown only when remote server responds with an error.

You can turn on logging to see, that this error is raised by your server:
https://www.limilabs.com/blog/logging-in-ftp-dll

This is the unit test I used to additionally check that:

[Test]
public void UploadDownload_2ToN_UploadsAndDownloads()
{
    byte[] bytes = new byte[8192];
    bytes[0] = 1;
    bytes[bytes.Length - 1] = 255;

    using (Ftp ftp = new Ftp())
    {
        ftp.Connect(TestConstants.LocalhostServer);
        ftp.Login(TestConstants.LocalhostUser, TestConstants.LocalhostPassword);

        ftp.Upload("8k.dat", bytes);
        byte[] downloaded = ftp.Download("8k.dat");
        ftp.DeleteFile("8k.dat");

        CollectionAssert.AreEqual(bytes, downloaded);
    }
}
by (297k points)
selected by
After analysing logs from other clients and ftp.dll, the only difference is 'mode z'. Bug in server... not in my control. Is it possible to tell ftp.dll NOT to use mode z?

EDIT: found it:         ftp.SetTransferMode(FtpTransferMode.Stream);
after login.
"MODE Z" turns the compression on. It greatly improves the transfer speed.
It is turned on automatically if server supports it (responds with "MODE Z" to "FEAT" command)

It can be turned off manually:

ftp.DontUseCompression = true;

What FTP server is that?
S: 220 Titan FTP Server 10.49.1901 Ready.
Thanks, that will help others.
...