I was wondering if anyone had any ideas on if or how you can implement bandwidth throttling with java?

Stephen Ostermiller

I would implement this by keeping a count of the number of bytes that you have written and read so far. Also keep a variable that has the time that you started reading or writing.

From these two you can compute your data rate. If your data rate is too high just sleep for a while.

You will need the following functions:
System.currentTimeMillis()
Thread.sleep()

It should be fairly easy to calculate how long you would need to sleep to bring your data rate down to the level you desire.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact