Advertisement

bandwidth control

Started by January 20, 2003 07:57 AM
0 comments, last by hpolloni 22 years ago
how can i specify how much bandwidth a program can use,im making an app that need to control the bandwidth it use. Sorry for my lame english
a) I think you can throttle bandwidth using QoS (Quality of Service), but this has to be supported by the OS and the router, etc...

b) Another more portable way to do it is to just keep tally of how many bytes are sent (this is returned by send() and recv() ) and the amount of time it has been sending/recving (using any number of timer functions).. bytes/time (in seconds) = Bps ... if the Bps goes over a certain threshold either don''t send the data until it goes beneath the threshold or calculate how many bytes you can send (Target Bytes/Sec * Num Seconds - Bytes Sent = How many bytes you can send without going over target Bps) and just send that many bytes..

It''s certainly extra work either way...

This topic is closed to new replies.

Advertisement