如何以编程方式限制我的 c# 应用程序的带宽使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/847422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to programmatically limit bandwidth usage of my c# application?
提问by Mats
I've got a backup application here which connects to various webservices and downloads/uploads files from ftp or http servers. What is the easiest way to limit the bandwidth usage of my application?
我在这里有一个备份应用程序,它连接到各种网络服务并从 ftp 或 http 服务器下载/上传文件。限制应用程序带宽使用的最简单方法是什么?
I need to do that because the application once installed and running will be slowing down internet access for all office people, which eventually will get me into hell. So I'd like to implement a speed-limit which is active during the work-hours and gets disabled at night.
我需要这样做,因为该应用程序一旦安装并运行就会减慢所有办公室人员的互联网访问速度,最终会让我陷入地狱。所以我想实施一个在工作时间有效并在晚上被禁用的速度限制。
采纳答案by Issa Qandil
What you are looking for is called Bandwidth throttlingAnd here is a good examplehow is this done, also review the comments to know how it is done from a client side.
您正在寻找的是所谓的带宽节流这是一个很好的例子,这是如何完成的,还可以查看评论以了解它是如何从客户端完成的。
You may also want to take a look at this exampletoo, putting things in a real application
您可能还想看看这个例子,把东西放在一个真正的应用程序中