问题描述
我说的是下载管理器中的速度限制.例如,在Internet Download Manager中,有一个选项:
I'm talking about speed limiting in download managers. For example, in Internet Download Manager there is a an option :
它如何限制速度?我的意思是,是否有某种Windows API?如果它是Linux应用程序怎么办?
How does it limit speed? I mean, is there some kind of Windows API for that? What if its a Linux application?
推荐答案
在Windows中可能有几种方法可以实现:
There are potentially several ways this can be done in Windows:
应用程序本身可以通过监视自己的比特率并根据需要在套接字上的recv()
或read()
调用之间休眠来隐式限制下载速度.
An application itself can implicitly limit the download speed by monitoring it's own bitrate and sleeping between recv()
or read()
calls on the socket as needed.
我怀疑Internet Download Manager可能会将其自身安装为本地HTTP代理,并配置浏览器以通过它路由所有请求.然后使用我上面介绍的简单技术,使用其自己的网络代码以适当的速率流式传输下载内容.看看是否为您的浏览器配置了一个http代理-如果这是它的工作,这应该是一个很好的提示.
I suspect Internet Download Manager may be installing itself as a local HTTP proxy and configuring the browsers to route all requests through it. And then uses its own networking code to stream the download at an appropriate rate using the simple technique I described above. Look to see if there is an http proxy configured for your browser - that should be a good hint if this is what it is doing.
另一种技术是使用Winsock分层服务提供程序或筛选器驱动程序.尝试从命令行键入netsh winsock show catalog
(已经安装了很多系统文件).
Another technique is to use a Winsock Layered Service Provider or filter driver. Try typing netsh winsock show catalog
from the command line (there are a lot of system ones already installed).
而且Winsock本身有一个旧的 QOS API 可以做到流量调整". (如果有内存可用,它甚至还提供了一些系统策略支持,可以在应用程序外部对其进行配置.)
And Winsock itself has an old QOS API that can do "traffic shaping" on a particular socket. (And if memory serves, it even has some system policy support where it can be configured externally outside of the app).
这篇关于Linux/Windows的哪个API对应于限制网络(下载/上传)速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!