I think I found a solution. Using the QOS API, you need to get the descriptor of the target interface using TcOpenInterface (you can find out which interface you want to target by calling TcEnumerateInterfaces ). Using the interface handle, you need to call TcAddFlow along with a pointer to TC_GEN_FLOW , which allows you to specify the SendingFlowspec
( FLOWSPEC ) and ReceivingFlowspec
( FLOWSPEC ) structures that contain the PeakBandwidth
element. Then, in order for your interface to use this stream that you just added to it, you need to add a filter to your interface using the TcAddFilter call, since MSDN says that the TcAddFilter function associates a new filter with an existing stream that allows you to transfer packets matching the filter , in the corresponding stream. I think that in order to make it application-specific, calling TcRegisterClient can do a trick that you will need to call anyway to get the client handle to use with TcEnumerateInterfaces and TcAddFlow from the look (but this remains to be verified). I found this useful example (not tested it).
Taken from MSDN, the PeakBandwidth
member is the upper limit on the time resolution for a given stream in bytes per second. The PeakBandwidth element limits the flows that can charge a significant amount of credits for transfer, or tokens from redundant network resources with one-time or cyclic data packets, by providing a data transfer ceiling per second. Some intermediate systems may take advantage of this information, resulting in a more efficient allocation of resources.
source share