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.
The easiest method to limit your upload speeds on a computer is with a third-party application to limit network transfer rates. Below are examples of software programs designed to limit the upload speed. NetLimiter official website. Throttled Pro official website (runs on macOS, FreeBSD, or Linux).
You can limit your internet WiFi speed usage through the QoS on your router. Just configure the QoS to set up the priorities for the different types of internet priorities so that there are certain internet uses that are not as prioritized as others. Installing traffic-shaping software also helps.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With