tcp flows own nature grow until fill maximum capacity of links used src
dst
(if links empty).
is there easy way limit ? want able send tcp flows maximum x mbps rate.
i thought sending x bytes per second using socket.send()
function , sleeping rest of time. if link gets congested , rate gets reduced, once link gets uncongested again need recover not send , rate increase.
at tcp level, control have how many bytes pass off send(), , how call it. once send() has handed on bytes networking stack, it's entirely networking stack how fast (or slow) wants send them.
given above, can limit transmission rate monitoring how many bytes have sent, , how time has elapsed since started sending, , holding off subsequent calls send() (and/or number of data bytes pass send()) keep average rate going higher target rate.
if want finer control that, you'll need use udp instead of tcp. udp have direct control of when each packet gets sent. (whereas tcp it's networking stack decides when send each packet, in packet, when resend dropped packet, etc)
Comments
Post a Comment