Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Setsockopt is unable to mark the Internet Protocol type of service bits in Internet Protocol packet header


View products that this article applies to.

Summary

Microsoft Windows 2000, Microsoft Windows XP, and Microsoft Windows Server 2003 do not support the marking of Internet Protocol (IP) Type of Service (ToS) bits with the setsockopt function.

↑ Back to the top


More information

On Windows NT 4.0 and Windows 9x, Winsock applications can set the ToS bits in the IP header for UDP and ICMP packets by calling the setsockopt function with the IP_TOS option. The ping utility on those platforms also allows the ToS bits marking in the ICMP echo packets by using the "-v" option. Please note that the ToS bits marking for TCP packets has never been available to Winsock even although the setsockopt call with the IP_TOS option on TCP sockets returns 0 (SUCCESS).

On Windows 2000, Windows XP, and Windows Server 2003, the ToS bits marking functionality in Winsock applications and the ping utility is disabled by default. The attempt to set the IP_TOS option with the setsockopt function on these versions of Microsoft Windows still returns 0 (SUCCESS) to allow applications to continue to run; but the ToS bits in the IP header is not marked.

This design change is because the former ToS and precedence bits specified in Request For Comment (RFC) 1349 have been made obsolete by RFCs 2474 and 2475. These RFCs replaced ToS with Differentiated Services (DiffServ).

DiffServ Code Point (DSCP) enables packets that pass through network devices operating on layer 3 information, such as routers, to have their relative priorities differentiated from one another. DSCP is established by setting the first six bits of the ToS field in the IP header. DSCP has assumed the function of determining IP precedence, but maintains backward compatibility. With DSCP marking, layer 3 devices can establish aggregated precedence-based queues and provide better service to packets that have a higher relative priority.

This is particularly beneficial when packet services are subject to queuing, as is the case under significant network traffic loads associated with streaming media presentations and other real-time data streams. For DSCP to be effective, layer 3 devices must be DSCP-enabled.

On Windows 2000-based, Windows XP-based, or Windows Server 2003-based host devices, the Generic Quality of Service (GQOS) implementation determines the DSCP marking. A Winsock GQOS program triggers the RSVP service provider to submit policy and resource checks to determine the policy control and the availability of resources along a network data path. If the intended resource usage is approved, the QOS Packet Scheduler service marks the DSCP prioritization in the IP packet headers. The IP_TOS option with the setsockopt function would bypass Windows 2000, Windows XP, or Windows Server 2003 QOS policy control, and thus is disabled by default on these versions of Windows.

Microsoft recommends that you implement GQOS in your Winsock programs to take advantage of the Windows 2000, Windows XP, and Windows Server 2003 GQOS capabilities. However, to allow for behavior similar to Windows NT 4.0 IP_TOS on Windows 2000, Windows XP, or Windows Server 2003 for backward compatibility, a new registry key has been added.

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows

Follow these steps to enable the IP_TOS option for the Winsock setsockopt function and the -v option for the ping utility on Windows 2000, Windows XP, or Windows Server 2003:
  1. Start Registry Editor (Regedt32.exe).
  2. Go to the following key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpIp\Parameters
  3. If you are running Windows 2000, follow these steps:
    1. On the Edit menu, click Add Value.
    2. In the Value name box, type DisableUserTOSSetting.
    3. In the Data Type list, click REG_DWORD, and then click OK.
    4. In the Data box, type a value of 0 (zero), and then click OK.
    If you are running Windows XP or Windows Server 2003, follow these steps:
    1. On the Edit menu, point to New, and then click DWORD Value.
    2. Type DisableUserTOSSetting as the entry name, and then press ENTER.

      When you add this entry, the value is set to 0 (zero). Do not change the value.
  4. Quit Registry Editor, and then restart the computer.
For information about the use and application of the Quality of Service (QoS) Application Programming Interfaces (APIs), which have effectively replaced the IP_ToS option, see MSDN Online and search for QoS.

For more information about traffic prioritization, click the following article numbers to view the articles in the Microsoft Knowledge Base:
222102 Traffic prioritization using IP precedence
222020 Description of 802.1P signaling
233039 QoS queuing techniques
For more information about the DisableUserTOSSetting registry entry in Windows Server 2003, visit the following Microsoft Web site:

↑ Back to the top


Keywords: KB248611, kbnetwork, kbinfo

↑ Back to the top

Article Info
Article ID : 248611
Revision : 9
Created on : 2/28/2007
Published on : 2/28/2007
Exists online : False
Views : 717