SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

############################################################################

libBand - Simple library to limit the bandwidth ############################################################################

LibBand is a simple library wrapper written in assembly and C (but we plan to rewrite everything in C) useful if you want to limit the bandwidth used by a program.
It simply overrides some libc functions, using the LD_PRELOAD environment variable, and puts some pauses in the program to clamp the bandwidth at the specified value, for both upload and download operations.
You just have to set UPLOAD_BAND and DOWNLOAD_BAND and run your program, for example:

export LD_PRELOAD=/replace-with-the-path/to/libband.so export UPLOAD_BAND=1024
export DOWNLOAD_BAND=8192
ftp somewhere.com

The bandwidth must be expressed in bytes/s, and so in the above example, we want the upload band clamped at 1.0 kb/s, the download band at 8.0 kb/s.

There's a small utility in the scripts/ directory, called lb: you can use it to set everything and start your program from a nice whiptail/dialog environment.

Just type "make" to compile, and "make install" to install the library. Remember that $HOME/lib is the default installation directory, so you usually have to export LD_PRELOAD by using: export LD_PRELOAD=$HOME/lib/libband.so
The "lb" script is configured to work with this path, but you may change it by editing the script itself (search for the LIBPATH variable).

Please note that at the moment libBand DOESN'T WORK with multithreaded and graphic applications.


Please send bug reports, comments and suggestions to: asus <asus@asus.homelinux.com>

<asus.tin@virgilio.it>
miasma <miasma@thus.ath.cx>

Thank you


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.