in reply to Limiting bandwidth

The best way is to have the server install bandwidth limiting software and use it for your account. The following seems to have the info you need:

http://www.onlamp.com/pub/a/bsd/2001/07/26/Big_Scary_Daemons.html

I don't know of any good way to limit bandwidth consumption from your script.