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.