How do you throttle the bandwidth of a socket connection in C?

后端 未结 3 1762
-上瘾入骨i
-上瘾入骨i 2020-11-30 04:17

I\'m writing a client-server app using BSD sockets. It needs to run in the background, continuously transferring data, but cannot hog the bandwidth of the network interface

3条回答
  •  青春惊慌失措
    2020-11-30 04:43

    I've had good luck with trickle. It's cool because it can throttle arbitrary user-space applications without modification. It works by preloading its own send/recv wrapper functions which do the bandwidth calculation for you.

    The biggest drawback I found was that it's hard to coordinate multiple applications that you want to share finite bandwidth. "trickled" helps, but I found it complicated.

    Update in 2017: it looks like trickle moved to https://github.com/mariusae/trickle

提交回复
热议问题