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:
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:
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.
What's New in This Release:
· We keep track of sockets by wrapping socket(), accept() and close(). The old fstat() mechanism has been obsoleted.