Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. determining transfer rate

determining transfer rate

Scheduled Pinned Locked Moved C#
helptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    damianrda
    wrote on last edited by
    #1

    hey guys, im writing a custom auto updater, its pretty much done, and i would like to incorporate a file transfer rate (Downloading at 288 KB/s) for when the updates are being downloaded. ive searched google, searched here, couldnt come up with a valid tutorial. im using webclient.downloadfileasync() to get the actual file, any help would be appreciated.

    S 1 Reply Last reply
    0
    • D damianrda

      hey guys, im writing a custom auto updater, its pretty much done, and i would like to incorporate a file transfer rate (Downloading at 288 KB/s) for when the updates are being downloaded. ive searched google, searched here, couldnt come up with a valid tutorial. im using webclient.downloadfileasync() to get the actual file, any help would be appreciated.

      S Offline
      S Offline
      snorkie
      wrote on last edited by
      #2

      If you are looking for average transfer rate and/or time remaining, it is fairly simple. Transfer Rate = amount downloaded / seconds elapased. Remaining Time = Total Size - Amount Downloaded / Transfer Rate. If you are using FTP as your mechanism... Stream ftpStream = response.GetResponseStream(); long cl = response.ContentLength; int bufferSize = 2048; int readCount; byte[] buffer = new byte[bufferSize]; int readCount = ftpStream.Read(buffer, 0, bufferSize); //download as long as the download is not cancelled. while (readCount > 0 && _continueUpdating) { //For calculationg speed and other good stuff. _bytesReceived += readCount; outputStream.Write(buffer, 0, readCount); readCount = ftpStream.Read(buffer, 0, bufferSize); } Good luck, I hope this helps!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups