LibBand is a simple library wrapper written in assembly and C (but I 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.
You need NASM to build the binary (but
don't worry, a pre-assembled version is included in the package).
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.
Download:
Instructions:
README
libBand 0.01: (latest)
libband-0.01.tar.gz
ChangeLog
libBand alpha:
libband-alpha.tar.gz
Links:
The libBand sourceforge project page is
here.
Contacts:
Please send feedback and bug reports to: