Bandwidth Throttling
1 posts in topic
Flat View  Flat View

Posted By:   Chris_Messina
Posted On:   Sunday, February 3, 2002 09:43 AM

I was wondering if anyone had any ideas on if or how you can implement bandwidth throttling with java? To clarify, how can I give my app the ability to give itself more or less of the available internet badwidth? And if it is possible at all can I let that vary depending on what types of protocols are already in use by other apps?


Re: Bandwidth Throttling

Posted By:   Stephen_Ostermiller  
Posted On:   Monday, February 4, 2002 11:06 AM

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 computer your data rate. If your data rate is too high just sleep for a while.

You will need the following functions:



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.

About | Sitemap | Contact