Get SFTP Transfer Speed

+1 vote
asked Feb 24 by robert3232 (130 points)

Does Rebex SFTP have a property where I can get the speed of a file transfer when it completes? I see a property that gives you the current speed, but I am looking for an average speed over the course of the upload/download. Thanks!

Applies to: Rebex SFTP

1 Answer

0 votes
answered Feb 25 by Lukas Matyska (59,450 points)

No, there is no such property.

However, you can compute average speed for yourself like this:

var watch = new System.Diagnostics.Stopwatch();

client.TransferProgressChanged += (s, e) =>
{
    Console.WriteLine("Current: {0}B/s", e.BytesPerSecond);
    Console.WriteLine("Average: {0}B/s", (long)(e.BytesTransferred / watch.Elapsed.TotalSeconds));
};

watch.Start();
client.Download("*", @"c:\data");
watch.Stop();
...