Limiting bandwidth consumption?

Apr 23, 2015 at 2:39 PM
Edited Apr 23, 2015 at 2:42 PM
Hi!
I have a requirement to limit the bandwidth consumption - e.g to 50 kb/sec.
Has anybody done this before? It doesn't have to be a very precise limit, so consuming 40-60 kb/sec would be ok. And limiting hte data streams only would also be fine.

I am considering extending FtpClient and overriding OpenDataStream to wrap the stream in a SpeedLimitedFtpDataStream which adds small Thread.sleep() calls based on the current speed.

Any suggestions or tips would be welcome!