Archived Forum Post

Index of archived forum posts

Question:

Is SFTP EOF detected correctly in 9.5.0.66?

May 02 '17 at 12:25

Hello,

I am downloading files and decrypting them on the fly. After updating to 0.66 the code below is not working.

byte[] b = new byte[524288];
byte[] decryptedChunk;
crypt.FirstChunk = true;
crypt.LastChunk = false;

Int64 received = 0;

while (!sftp.Eof(handle))
{
    b = sftp.ReadFileBytes(handle, b.Length);

    if (sftp.Eof(handle))
    {
        crypt.LastChunk = true;
    }

    decryptedChunk = crypt.DecryptBytes(b);
    fsOut.Write(decryptedChunk, 0, decryptedChunk.Length);
    crypt.FirstChunk = false;

    received += b.Length;
    Console.WriteLine(received.ToString());
}

With the previous versions (9.5.0.65) the file downloaded and decrypted successfully, but with the new one the download process not stopping at the end of the file.

Any suggestion?

Thank you!


Accepted Answer

I think this new build should fix the missing callbacks:
https://chilkatdownload.com/prerelease/chilkatdotnet45-vs2013-9.5.0-win32.zip
https://chilkatdownload.com/prerelease/chilkatdotnet45-vs2013-9.5.0-x64.zip


Answer

Thanks, I'll investigate tomorrow..


Answer

I found the problem and made the fix. What version of the .NET Frameworks and what version of Visual Studio do you use? I can provide a new build that fixes it.


Answer

Great, thank you! .NET 4.5 and VS2013, 32 and 64 bit.


Answer

Thanks, here are the new builds:

https://chilkatdownload.com/prerelease/chilkatdotnet45-vs2013-9.5.0-win32.zip
https://chilkatdownload.com/prerelease/chilkatdotnet45-vs2013-9.5.0-x64.zip


Answer

Thank you! The download is working now, but the OnDownloadRate event is not firing. The code above worked fine with 9.5.0.65.

...
sftp.EnableEvents = true;
sftp.HeartbeatMs = 10;
sftp.OnDownloadRate += sftp_OnDownloadRate;
...

private void sftp_OnDownloadRate(object sender, Chilkat.DataRateEventArgs args)
{
    Console.WriteLine(args.ByteCount);
    Console.WriteLine(args.BytesPerSec);
}

Thank you!


Answer

I was able to download the latest version (I have no idea what was the problem yesterday...) and everything is working fine! Thanks!