Date: Wed, 6 Nov 1996 12:46:15 -0800 (PST) From: Archie Cobbs <archie@whistle.com> 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: <199611062046.MAA08387@bubba.whistle.com> In-Reply-To: <199611061411.IAA08311@brasil.moneng.mei.com> from Joe Greco at "Nov 6, 96 08:11:58 am"
index | next in thread | previous in thread | raw e-mail
> > 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.
> >
> > [ ... ]
> >
> > Anyone know how to do this?
>
> int s, rval;
>
> s = socket(...);
>
> while ((rval = read(..., 1024)) > 0) {
> sleep(1);
> }
>
> if (rval < 0) {
> perror(...);
> }
This also might be a good application for divert(4) sockets .. just
stick in a daemon that throttles the I/O on whatever connections you
want to throttle... basically, doing the same as above except your
exiting applications don't have to be modified.
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611062046.MAA08387>
