I found some sample code on setting the ToS byte of an IP packet that you are sending out in C#, but can't seem to get it to work. What I have is very simple:
Code:
public static void Main(string[] args)
{
Console.WriteLine("Testing DSCP packet marking.Wireshark should already be running!\n");
UdpClient cli = new UdpClient();
//TcpClient cli = new TcpClient();
cli.Client.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.TypeOfService, 136);
byte[] buf = new byte[16];
//I fill buff here
cli.Connect("192.168.4.100", 10100);
cli.Send(buf, buf.Length);
/*NetworkStream mystream = cli.GetStream();
if (mystream != null)
{
mystream.Write(buf, 0, buf.Length);
}
if(cli.Connected)
cli.Close();*/
}
As you can see, I've tried this with both TCP and UDP. But when I view the traffic that gets sent out in wireshark, the diffserve byte is always 0. I can see that the payload is filled with what I set buf too, so I know I'm looking at my packet. Am I missing something?