//Check for registry keys
RegistryKey rkToS = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters", true);
// If the return value is null, the key doesn't exist
if (rkToS == null)
{
// The key doesn't exist; create it
rkToS = Registry.LocalMachine.CreateSubKey("SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters");
}
// Attempt to retrieve the value for DisableUserTOSSetting; if null returned, the value doesn't exist in the registry.
if (rkToS.GetValue("DisableUserTOSSetting") != null)
{
// The value exists;
int checkToSKey = (int)rkToS.GetValue("DisableUserTOSSetting");
//Check if it has the right value
if (checkToSKey != 0)
{
//Wrong value...correcting it
rkToS.SetValue("DisableUserTOSSetting", 0);
MessageBox.Show("I have just changed the Registry Key to enable ToS values.\nFor this to take effect, you need to restart your computer!");
return;
}
}
else
{
//add value
rkToS.SetValue("DisableUserTOSSetting", 0);
MessageBox.Show("I have just added the Registry Key to enable ToS values.\nFor this to take effect, you need to restart your computer!");
return;
}
Auto enable ToS/DSCP setting in the Registry in C#
16 04 2009Comments : Leave a Comment »
Tags: C#, DisableUserTOSSetting, DSCP, regedit, Registry Key, TCPIP, ToS
Categories : C#, Networking, Random Code
How to change ToS or DSCP values in IP header while sending a Ping, in Microsoft Windows products?
13 04 2009By default, if you use the following command: “ping -v 8”, it would not change the ToS/DSCP value in the IP header in the ICMP Packet, even though you get no errors.
To enable this in windows, follow the steps below:
- Open regedit
- Go to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpIp\Parameters
- If you are running Windows XP or Windows Server 2003, follow these steps:
- On the Edit menu, point to New, and then click DWORD Value.
- 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.)
- Quit Registry Editor, and then restart the computer.
- After restarting the computer, in command prompt, type “ping <ip address> -v 8”, while taking a wired capture. You would see the DSCP value changed.
For more information, please refer to:
Comments : Leave a Comment »
Tags: DSCP, ICMP, Microsoft, Ping, qos, ToS, Windows
Categories : Networking