Adding QOS2 calls in a sample Winsock application: Part 2


Hopefully you’ve read the previous entry with the QOS2 sample. Here are the answers to questions you might have.



  1. What header file do I need to include? qos2.h
  2. Is this only for user-mode applications? yes it is. However, leave us a comment if you need a kernel mode QOS API. We’ll want to learn more about your scenario.
  3. What library do I link against? qwave.lib
  4. What DLL will this pull into my application? qwave.dll
  5. QOSCreateHandle returns a file handle; can I attach it to a I/O completion port? yes, you can. Since some of the other calls take OVERLAPPED structures, you can use a completion port for asynchronous completions.
  6. Why do you set the QoSFlowID variable to 0 before calling QOSAddSocketToFlow? Because 0 signifies that you want a new flow. You could use another value to refer to an existing flow (which you would have created earlier). More about this later.
  7. Why did you use the QOS_NON_ADAPTIVE_FLOW flag? Because this is a non-adaptive scenario. More about this later.
  8. What is the flowtype QOSTrafficTypeExcellentEffort? It’s one of the flow type  the QOS subsystem will recognize. It maps to a set of DSCP and, if applicable, 802.1p values. Gabe wrote about the different flowtypes in his post about WMM recently.

Next we’ll describe what else you can do with a non-adaptive flow.


– Mathias Jourdain

Comments (6)

  1. Steve Rothkin says:

    Is QOS2 available ONLY o Vista, or is it also available on Windows XP (and do we need to do anything special to use it on XP)?

    Is qwave.dll part of the operating system, or is it a development runtime that has to be included in our product’s installation package?

    Qos2 was introduced in Vista and is part of the OS

    — Ari

  2. Daniel says:

    I have come across this entry because we indeed use QoS in kernel mode (it works in Windows 2003 server, but a customer complains that his 2008 server doesn’t set the ToS bits).

    So the kernel mode QoS2 API sounds like the solution to our problem 🙂

    FYI: we use it in a VoIP product which connects UM applications (voice/fax servers etc) to IP-PBXs (depending on the hardware and infrastructure, we can use several 100 lines simultaneously on one server), and some customers want to enable QoS for signaling and data.

  3. Amit says:

    We are using following code snippet for QOSAddSocketToFlow() for QOS purpose in our client application, but we are getting error 87.

    <Intilization>

       QoSFlowID = 0

       hints.ai_family = AF_UNSPEC;

       hints.ai_socktype = SOCK_STREAM;

       hints.ai_protocol = IPPROTO_TCP;

       <Created the socket>

      <Created OQS handle using QOSCreateHandle>

      QoSResult = QOSCreateHandle(&version, &QoSHandle); //This call returns success.

       QoSResult = QOSAddSocketToFlow(QoSHandle, ConnectSocket,(PSOCKADDR)&ptr, QOSTrafficTypeExcellentEffort, QOS_NON_ADAPTIVE_FLOW, &QoSFlowID);  This function returns the error code 87 as QOSResult is false.

    Please let us know how to solve the problem?

  4. Patricio says:

    Hello,

    I'm looking to use QOSSetFlow function in the QoS2 API. However, the QOSSetOutgoingDSCPValue is not defined in the header file that comes included with the operating system. I'm using Windows 7 OS and compiling with Visual Studio 2008. I've installed the Windows 7 SDK for .NET 3.5SP1. Is there something missing here? The documentation clearly shows the QOSSetOutgoingDSCPValue enumeration at msdn.microsoft.com/…/aa374047(v=vs.85).aspx but when I compile i get

    "Error 1 error C2065: 'QOSSetOutgoingDSCPValue' : undeclared identifier"

  5. Gaurav says:

    Hello,

    I am in need of QOS in kernel mode. So if you have any idea or APIs please help me out.

  6. Tony says:

    I know this is an old thread but I just started working with the api.  Patricio, you need to use VS 2010 or greater to see the third enum value.