Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 1996 16:07:40 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        jgreco@brasil.moneng.mei.com (Joe Greco)
Cc:        hannibal@cyberstation.net, hackers@freebsd.org
Subject:   Re: Limiting bandwidth on a socket?  (SO_RCVBUF?)
Message-ID:  <199611061507.QAA08319@labinfo.iet.unipi.it>
In-Reply-To: <199611061411.IAA08311@brasil.moneng.mei.com> from "Joe Greco" at Nov 6, 96 08:11:39 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > I'm trying to come up with some way to limit the amount of bandwidth on a
> > socket, so I can have my mail and large files retrieve without slowing
> > down a telnet session that much.
> > 
...
> > 
> > I could swear I saw a "low-bandwidth ncftp" or something of the sort on
> > sunsite.unc.edu a couple years ago, so I think this is possible (Well, at
> > least in Linux...).  It's apparently been deleted though.

Some ftp sites (e.g. funic.funet.fi) tell you the amount of bandwidth
that has been allocated to your ftp connection. Try to look at what
kind of ftp server they use.

...
[code to insert sleep() between read/writes removed]
> 
> You can adjust the number of bytes read and the sleep() value to arange for
> many different potential amounts of bandwidth.
...
> The downside is that it generally requires C code modifications.
> 
> I am not aware of any general way to do this without code modifications,
> without the introduction of specialized code such as ET's bandwidth
> manager (and I am by no means certain that BWMGR can handle this).

I think to remember this was discussed some time ago on the hackers list.
Unfortunately I don't remember the outcome of the discussion.

If you work inside the kernel (see the 'dummynet" stuff in my
home page, it introduces bandwidth limitations on your link; with a
little effort it can be configured to set different limitations on
different TCP/UDP ports), you can avoid modifying program sources,
which is extremely annoying. Otherwise, for servers which are launched
by inetd, perhaps you can add a bandwidth-limiter process between your
process and the socket and again avoid having to modify sources.
Perhaps tcp_wrappers do this ?

> I will note that some PPP/SLIP software allows prioritization of certain
> types of traffic, by way of "TOS" (type of service) queue reordering.  
> This works moderately well when the MTU is small and the amount of data
> being buffered by the modem is very small.  Cheap modems generally do not
> give you that level of control.

I don't think the modem takes more than 128-256 bytes of data, so
packet prioritization inside the PPP sw can serve the purpose.

	Luigi
====================================================================
Luigi Rizzo                     Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it       Universita' di Pisa
tel: +39-50-568533              via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522              http://www.iet.unipi.it/~luigi/
====================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611061507.QAA08319>