What API of Linux/Windows corresponds to limiting network (download/upload) speed?

后端 未结 4 1416
谎友^
谎友^ 2021-02-09 03:15

I\'m talking about speed limiting in download managers. For example, in Internet Download Manager there is a an option :

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-09 03:28

    @selbie's pointing you in the right direction. I just want to elaborate:

    The recipient can really only control speed for large downloads. For really small downloads, TCP slow-start will control bandwidth. Not-quite-as-small downloads (up to the negotiated TCP window size limit) will complete as fast as the connection allows, because TCP flow control depends on ACKs, and the sender won't be waiting for any ACKs. For medium size downloads (up to the socket buffer size) the OS will acknowledge the packet immediately, these will complete as fast as the connection allows and the application has no control. Only once the socket buffer fills, can the application delay recv and cause backpressure that limits the transmission rate. Solutions inside the network stack (QOS or filter driver) are needed for shorter transmissions.

    If the protocol provides a way to ask the sender to set the transmit speed, that would be most effective.

提交回复
热议问题