Thread: QoS on Windows 7

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    4

    QoS on Windows 7

    I'm trying to code a simple UDP client that can be used for voice testing and it needs to set the ToS byte in the IP header. On Linux, I would simply:

    Code:
    ...
    setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&ipTOS, sizeof(ipTOS))
    ...
    Alas, on Windows XP, this would also work if I hack a registry setting:

    Code:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpIp\Parameters
    
    DisableUserTOSSetting: REG_DWORD = 0
    On Windows 7, this is not an option. Google searching has lead to QoS2 API and qWAVE. It seems terribly overcomplicated and woefully underpowered for custom DSCP assignment to IP_TOS. Nonetheless, I found a guide at:

    Adding QOS2 calls in a sample Winsock application: Part 1 - Windows Core Networking - Site Home - MSDN Blogs

    Trying that out, it compiles in my code, but when run, I get an error 1068 at the QosCreateHandle() call - which means "Dependency service or group failed to start." Under Windows Services, the qWAVE service is set to 'Manual' and is not started. When I try to start it, I get an error 1075: "The dependency service does not exist or has been marked for deletion".

    My original UDP client (without the QoS piece) compiles and works fine - of course *not* setting the ToS byte. That's the only piece I'm stuck on. This is becoming *WAY* more work than I expected. Does anyone have any experience with the QoS2 API or (without using the WinPcap library) know how to code ToS onto a Windows socket?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    4
    I realize this isn't a code writing service, but how about an example?

    I've looked at the documentation for WSAIoctl and while there is a SIO_SET_QOS option which uses a QOS structure, I'm not sure how this applies to setting the actual DSCP value in the ToS byte of IP packets on a given socket. Researching the QOS structure, it contains two FLOWSPEC structures, (SendingFlowspec being the one I'd be interested in) which in turn define settings for token buckets and peak bandwidths, etc... While those values do contribute to QoS as an umbrella entity, I'm not interested in traffic control, simply setting DSCP on packets so I can watch how my network behaves (not the end host running the test program).

    I see a SERVICETYPE structure in the FLOWSPEC structure, but this seems to apply to RSVP signalling. If it does indeed set DSCP, it does not allow for the granular control I need to set DSCP to EF (0x46) for voice bearer and DSCP CS3 (0x24) for voice signalling.

    My last resort was to look at the 'WSABUF ProviderSpecific' member of the QOS structure but the QoS Objects it allows you to define seem again to be related to traffic control and/or RSVP - not the granular setting of the bits in the ToS byte to define DSCP.

    I'm starting to play with this to see if it indeed helps, but I fear this will be another dead end. Again, any examples you can provide that show I can manipulate the bits of the ToS byte (like setsockopt(...IP_TOS...) works on Linux), would be most appreciated.




  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Click on it! It takes you right to the MSDN documentation of the command and everything is explained there. One might reasonably use GET_QOS first, then adjust only what needs changing and then send it back.


    You do of course realise that Windows supports setsockopt() as well.

    Some of these may be helpful to you as well.

    Frankly, unless your application is running consistently near bandwidth limits I doubt adjusting QOS settings and features is going to make much of a difference.
    Last edited by CommonTater; 12-09-2011 at 11:08 AM.

  5. #5
    Registered User
    Join Date
    Dec 2011
    Posts
    4
    I did, that's what my reply detailed - the information I found on that page and related pages detailing the structures that support the call. While Windows, does support setsockopt(), it does not support the IP_TOS socket option, at least not without a registry tweak in XP and not at all on Windows 7. See here:

    IPPROTO_IP Socket Options

    Go to the bottom table named: Windows Support for IP_PROTO options.

    The WSAIoctl() function seems to be describing GQoS, which I can't determine if it is supported in Windows 7 - it certainly isn't the 'preferred' API; that seems to be QoS2 or qWAVE ... see here:

    QOS History

    I've already read through the other links you sent before I posted originally. I did do my "homework" - posting here was a last resort.

    Remember, I'm trying to code a test program. It *has* to send DSCP settings - not so that the workstation from which it is running can be evaluated - but so that the network path that passes the packets along can be examined (using router show commands) to verify that the correct DSCP marking has been applied at the originating end and is passed throughout the network.

    I have this working fine on Linux (setsockopt(...IP_TOS...))and I wish I could just stop there, but the client wants a Windows version also since their IT staff has Windows laptops.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Well... I've hit the end of my (somewhat limited) knowledge of this topic.

    I'll step aside and let the others in here to help you out...

    Sorry I couldn't give you the right answer.

  7. #7
    Registered User
    Join Date
    Dec 2011
    Posts
    4
    No worries - very much appreciate the quick feedback.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Access Windows directory with OPENFILENAME in Windows mobile
    By nikhilesh1987 in forum Windows Programming
    Replies: 2
    Last Post: 05-31-2011, 02:49 AM
  2. GetDiskFreeSpace Windows API fails on windows 2000
    By dnyampawar in forum Windows Programming
    Replies: 7
    Last Post: 07-09-2009, 03:39 AM
  3. Differences between Windows XP and Windows Vista programming
    By nathan3011 in forum Windows Programming
    Replies: 3
    Last Post: 01-15-2009, 10:05 AM
  4. Open an excel file from a windows service under Windows Vista
    By AdrianaLuby in forum C# Programming
    Replies: 1
    Last Post: 06-05-2007, 03:55 AM
  5. Replies: 6
    Last Post: 01-07-2002, 02:46 AM

Tags for this Thread