View Full Version : Limit bandwidth using Win32API?

04-19-2004, 05:37 PM
Hi people,

I've registered at this forum specifically to ask this question, so I really hope I get some useful replies... :)

I am a member of an Unreal Tournament 2004 2on2 TDM clan, and we play competitively against other clans. As probably most of you know, you need to have a good ping to the server to have a smooth, non-laggy game. Which means you need all the bandwidth you can get from your connection.

The problem is, that my PC is part of a home-network, with a router between the PC's and my cable modem. My family members know next to nothing about computers, and don't even know what the word "bandwidth" means :rolleyes:. So, stuff like this happens:
I'm in a clanwar, trying to be at least of SOME assistance to my teammates, when my little sister (16 years old, thinks the world revolves around her) decides this is a good time for her to fire up her webcam on MSN, or start DLing a movie on Kazaa :rolleyes:. This ofcourse stuff like this costs us the game, and a lot of nerves aswell :mad:

So now I was thinking to write a client-server C++ program that can limit bandwith on the machine it runs on. The server would be run on the 2 other networked PC's and the client on mine, so that I can connect to the other PC's and tell them to limit bandwidth to (for example) 1 kb/s up and down.
Now I'm 99% certain there are a couple of simple Win32 API functions that can do just that, but MSDN so far hasn't come up with anything useful. I DID find some info on the Traffic Control part of MS QoS services thingy, but I don't think it's what I'm looking for.

Any help I can get with this is MUCH appreciated, thanks in advance,


PS: Sorry for my bad English, it is not my primary language ;)

04-20-2004, 02:08 AM
First off, welcome to the board! I try to be as helpful as I can, but usually find my knowledge lacking so hopefully someone else can help you better.

I don't think you need to write this from scratch, unless you REALLY want to (but in that case I couldn't help you too much..). There is software out there.

I found a few links that may spark some thoughts in your mind to help you out in your quest:

I'm not very knowledgeable as far as networks go, but I'd imagine that you'd need a gateway of some sort.

Like the internet comes into the house, probably into a router and then gets "split" into each individual computer. Well there's not a whole lot of room to stick a server in between there. Unless of course your router has that feature...

I've never setup a gateway, but I'd imagine that's what you'd need and I'm sure there's lots of info online as to how to go about doing something like that. I've heard of e-smith, and that's supposed to be a good one, but you can do your own research and see what works best for you.

Post back and let me know if that's what you were looking to do or if I was totally off.

Good luck,

06-15-2004, 05:48 PM
I'm facing the same problem. Is there any solution? i had go google, yahoo to find the material, but i still cannot get any information about Limiting Bandwidth.

Most of the forum ask us to purchase netlimiter (www.netlimiter.com). But i plan to do one. I'm still waiting for expert to give us some hint. Thanks

06-15-2004, 06:45 PM
I'm not exactly sure how to go about creating the bandwidth monitor for your network. One problem is that to be effective, the application would have to inspect every single packet. This process takes time, and could have an adverse effect on your network.

Look at products like Squid (http://www.squid-cache.org/) and Packet Shaper (http://www.packeteer.com). (Here's an article (http://networking.earthweb.com/netos/article.php/3365771) on setting up and using squid)

There is a whitepaper available here (http://www.zeus.com/about/wp/register.cgi), but i've not yet read it.

Your switch/router may have built-in throttling. One option would be to simply disable the kazaa port in the router while you're playing in your clan matches, but that would only be a temporary, single-application solution.

A bandwidth throttling application would be a pain in the rump to code, I think. It would have to low-level listen on the nic, and adjust corresponding traffic, which (I don't think) will be an easy task. (you'd have to do this because not all applications are QoS aware).

I think you could setup a gateway linux box and use iptables to do some bandwidth throttling...

Also take a look at this link: http://www.tweakxp.com/tweak282.aspx , as it has some more information on setting QoS options.


06-16-2004, 01:32 PM
The problem are they will like to download mp3, avi thru flashget or kazaa and so on. Thus we are allow them to download but limit their bandwidth according to the services are needed. Some of software control the whole bandwidth of their nic but it will affect the bandwidth of files sharing in LAN.

In market, there are lot of software about bandwidth control. So means that a lot experts know how to control the bandwidth of workstation. I hope you all really can give us some hints. Thanks. :thumbsup:

06-16-2004, 03:22 PM
one way to seriously help is to go into the network properties of each nic you want to limit bandwidth on, and click the "configure" / "properties" button for the nic. Adjust the duplex mode to 10/half. That should help a bit :P


06-17-2004, 02:11 PM
Is not winroute a program that does this?

06-20-2004, 10:20 AM
what we like to do is similar to "netlimiter" but simple/lite version. We would like to create a program to control the bandwidth of the programs in workstation.