I am making application in c#. I am getting data on 24097 port continuously and i am recording that data as
UdpClient client = null;
IPEndPoint ipep = null;
client = new UdpClient(24097);
client.Client.ReceiveBufferSize = 25000;
ipep = new IPEndPoint(IPAddress.Any,24097);
while(flag)
{
byte[] data= = client.Receive(ref ipep);
}
But my problem is whatever packets i am getting are not in sequential order. I want to receive them in sequential manner. Please help me.Thanks in advance.
UDP does not guarantee anything about the order of the data you send. It is "fire and forget". If you need to keep the data in an ordered stream, you need to use TCP.
Otherwise, you would need to implement some sort of sequence ID in your datagrams themselves.