I have an artificially made network (homework) that I think makes the packets out of order
, I'm not completely certain as there's also frequent packet loss in short bursts.
So I was wondering if it's possible to determine or number DatagramPacket
s on the sender side so the receiver could check whether they're in order or not.
IP packets don't have a sequence number. UDP segments don't have a sequence number. TCP segments do have a sequence number, but out-of-order segments are handled automatically by TCP.
If you are using UDP, you will need to create your own datagram type as the UDP payload, and you can include a sequence number in your datagram. For instance, RTP, typically carried in UDP segments, has a sequence number.