how to measure download/upload speed? (programming, C#)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • halimunan
    New Member
    • Jun 2007
    • 7

    how to measure download/upload speed? (programming, C#)

    Hello all,

    I have a question, how do i measure the download/upload speed... as if download rate, upload rate or kbps transfer rate.
    i want to do my own windows application using C# to measure the download speed.

    the idea is this.
    1. i will put a file at a serverA.
    2. i download the file
    3. i measure the speed of the download(how long it would take me to complete the download)

    the question:
    1. how do i calculate the transfer time? the speed..?
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Welcome to TSDN. One way would to take the time at the start and measure the datetime diff when finished. HTH.

    Comment

    • halimunan
      New Member
      • Jun 2007
      • 7

      #3
      Originally posted by kenobewan
      Welcome to TSDN. One way would to take the time at the start and measure the datetime diff when finished. HTH.

      hrm.. okay... i know how to measure the difference between two time..

      but how do i set the starting point when the download start... and of course when the download completed.

      DateTime startTime = DateTime.Now; <--- where should i put this?
      DateTime stopTime = DateTime.Now; <--- and where should i put this?


      i mean.. maybe start time i can put it when i click the download/upload button...
      but how do i get the completed time?

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        I suggest placing them at the begining and end of the on click function, usually with a popup to say that the download has finished and a time diff before to calculate. HTH.

        Comment

        • userkv
          New Member
          • Aug 2007
          • 1

          #5
          I'm facing a similar problem. Here is the scenario. I have a server component in C# from where files will be downloaded using a C# client.

          Once the download starts, I need to show the current transfer rate and the estimated time to completely download the file. Again, I need to show this information as soon as the download starts and not at the end of the download process.

          Also, is there any way to restrict the bandwidth for a socket programmaticall y?

          Thanks in advance.

          Comment

          Working...