libband 0.01 review

Download
by rbytes.net on

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

License: GPL (GNU General Public License)
File size: 0K
Developer: Andrea
0 stars award from rbytes.net

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.

What's New in This Release:
We keep track of sockets by wrapping socket(), accept() and close(). The old fstat() mechanism has been obsoleted.

libband 0.01 keywords