Programmers' Resources

Slowpipe allows the restriction of bandwidth on a modem network connection where a Unix pipe may be used. It was written to address a problem for users of a small network connected to a larger network with a low bandwidth connection.

If you use such a connection for both interactive work, and transfer of large files it is possible that using programs such as ftp will consume all available bandwith, making the use of terminal emulators, X-windows etc., near impossible until the transfer is complete.

Slowpipe is a simple pipe filter intended to pass all characters through unchanged, but to limit the transfer rate. It does not however have any special knowledge of TCP/IP or other protocols. You may wish to change the packet sizes to multiples of the MTU to your host network for optimal performance if you are able to establish this. The default values though have been found to work satisfactorily on more than one network. The ideal solution is to reconfigure the router to your host network to restrict bandwidth on specific ranges of TCP/IP port numbers though this was not possible in my case.

Slowpipe has been tested under Linux and AIX and appears to perform as expected - though I offer no guarantees as this is free software. The user of the software must test their build. No liabilty shall be accepted for failure to perform as expected or consequential damages.

I emphasise that this is a simple solution and better solutions may exist - but it solved our problem.

The timing loop assumes that it takes zero time to read from the standard input. You will find the actual transfer rates to be marginally incorrect, though they are accurate enough to provide control.

Transfer rates are specified in kilobytes per second. As a guidline, try about one third of the rate you can achieve with ftp.

Example: to copy a directory tree to the home directory on a remote system

tar cvf - | slowpipe 2.0 | rsh remotehost tar xvf -

where remotehost is the name of the remote system

Last updated 3 November 1996

Back to the Programmers' Index Page.
Load images to see the counter