If you want to perform rate shaping or rate limiting to control bandwidth usage on your Windows XP computer, there are several low-cost products (FlowPatrol, for example) that classify application traffic on-the-fly. You can prioritize different traffic classes and dictate an upper bound on how much of your network link can be used by each class.
If your goal is to write your own rate shaping/limiting engine, you will need to write a network packet filter, and you'll want to do this in C/C++. I'd recommend checking out the Winsock Layered Service Provider (LSP). It is possible to call the kernel-mode TCP/IP driver from the Transport Data Interface (TDI), but if your product needs to manipulate and inspect all packets, it cannot rely on Winsock LSP. Instead, implement it with a Kernel-Mode Network Filter, which is a filter driver right above the kernel-mode TCP/IP driver. (Winsock LSP and TDI are available in the Microsoft Platform SDK that is available from the Microsoft website.) Be warned that development at either of these layers requires a thorough understanding of device driver programming.
This was first published in December 2005