example
Closed this issue · 8 comments
Hi,
I try to use TokenBucket to limit the output rate of an UDP send... and I fail
Could you give us an example of how to use that class?
If I want to limit at X Mbps an UDP flow @ MTU octets per packet, how can I do?
thanks
Consume one token per byte. Set max rate to number of bytes per second.
Hi, thanks for answer
but what about burst size?
I tried this:
rate = 12500 (ko/s)
bs = 12500 (ko)
TokenBuket t(rate, bs);
if (t.consume(bs)) {
//send bs octets
} else {
sleep_for(1ms);
}
And I have ~ 700Mo/s with local loop
I missed something ... and I don't find
sorry for repeating the same question... thx for your help ;)
... and it works better with one instance :D
I get an average rate 30% over limit choosen
The µs resolution make the object difficult to use with octect/s directly, would switch to ns make it easier?
my mistake... with a correct measure, it's ok
thanks a lot for help!