1

I have a UdpClient socket that receives UDP packets. Sample code below.

var clientSocket = new UdpClient(ipLocalEndPoint);
clientSocket.Connect(serverIp, port);
while (true)
{
    var ipEndPoint = new IPEndPoint(IPAddress.Any, 0);
    var data = ClientSocket.Receive(ref ipEndPoint);
    HandleMessage(data);
}

I receive the data from the UDP packets in a byte array. No problems there.

But what I would like to see, besides the payload, is the actual data from the package. What I'm most interested in is the packet's Identification number, just like the one I can see in a WireShark trace. (see image) How do I get this information?

I can use this information to tell me that I have missing UDP packets. The UDP 'stream' has identification numbers that normally increases its number by one.

enter image description here

Frank
  • 431
  • 1
  • 5
  • 25
  • It is in the IP header. See msdn : https://code.msdn.microsoft.com/How-to-read-IP-header-and-a754677a – jdweng Dec 18 '18 at 15:04

0 Answers0