Reputation: 24717
I want to limit the bandwidth of all downloads and uploads to be performed in the application.
The reason is that the application runs code not written by me. I don't want some malicious code to over use the network resource.
Upvotes: 5
Views: 8022
Reputation: 37533
Here is a link on SO that covers a similar question:
How can I rate limit an upload using TcpClient?
In a nutshell, you need to detect the bandwidth of the connected socket and then sleep overly fast connections.
Here is a link to a CodeProject source that makes use of throttling techniques:
http://www.codeproject.com/KB/IP/Bandwidth_throttling.aspx
Upvotes: 6