Search code examples
c#bandwidth

Limit Bandwidth Speeds


i wrote an app that sync's local folders with online folders, but it eats all my bandwidth, how can i limit the amount of bandwidth the app use? (programatically)?


Solution

  • Take a look at http://www.codeproject.com/KB/IP/MyDownloader.aspx

    He's using the well known technique which can be found in Downloader.Extension\SpeedLimit

    Basically, before more data is read of a stream, a check is performed on how much data has actually been read since the previous iteration . If that rate exceeds the max rate, then the read command is suspended for a very short time and the check is repeated. Most applications use this technique.