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



The information in this article applies to:

  • Microsoft Windows Server 2003, Standard Edition
  • Microsoft Windows Server 2003, Enterprise Edition
  • Microsoft Windows Server 2003, Web Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows XP Home Edition
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows NT Server 4.0
  • Microsoft Windows NT Server 4.0 SP5
  • Microsoft Windows NT Workstation 4.0
  • Microsoft Windows NT Workstation 4.0 SP5

This article was previously published under Q248611
Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry

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.

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.

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.
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:

Modification Type:MinorLast Reviewed:2/15/2006
Keywords:kbinfo kbnetwork KB248611