+1 vote
by (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
by (73.5k 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();
...