Finding Download Speed using DownloadFileAsync

  • Thread starter Thread starter greatbarrier86
  • Start date Start date
G

greatbarrier86

Hi,

I know there isn't a specific event property for the download speed, but can
anyone tell me how to find it? I'm not sure how to write the code.

Thanks,
Jason
 
Before calling the function you need to do two things:
1) Either the record the time or create and start a Stopwatch in a class
level variable (function level is you use an anonymous function for part 2)
2) Add an event handler to the DownloadProgressChanged event.
3) When the event is fired, the DownloadProgressChangedEventArgs has
BytesReceived property, you can then see either
a) how much has been downloaded and the elasped time since the last time the
event was fired for a current rate, or how much since the start of downlaod
to get an average rate for the file (less helpful to a watching user of
course).

The DownloadProgressChangedEventArgs also has the TotalBytesToReceive
property which you can use along with the speed to work out the time
remaining.

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top