From owner-freebsd-hackers Wed Nov 6 07:52:17 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA27064 for hackers-outgoing; Wed, 6 Nov 1996 07:52:17 -0800 (PST) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id HAA26981 for ; Wed, 6 Nov 1996 07:51:42 -0800 (PST) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id QAA08319; Wed, 6 Nov 1996 16:07:40 +0100 From: Luigi Rizzo Message-Id: <199611061507.QAA08319@labinfo.iet.unipi.it> Subject: Re: Limiting bandwidth on a socket? (SO_RCVBUF?) To: jgreco@brasil.moneng.mei.com (Joe Greco) Date: Wed, 6 Nov 1996 16:07:40 +0100 (MET) Cc: hannibal@cyberstation.net, hackers@freebsd.org In-Reply-To: <199611061411.IAA08311@brasil.moneng.mei.com> from "Joe Greco" at Nov 6, 96 08:11:39 am X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > 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/ ====================================================================