Marcel
Marcel

Reputation: 33

UDP order of bytes in a packet

I am working on a application where a couple of clients are streaming audio to a Rasbperry PI via UDP. From other topics I understand that the order of the packets send via UDP are not guaranteed to arrive in the same order. But how about the bytes in a packet, can I assume these will arrive in the same order then that they are send by the sender?

I want to embed some status information of the sender into a package, can I use lets say the first couple of bytes of the package to do this? In this case I need to be sure that these bytes are on the same position at the sender and receiver. And is this a good approach to follow?

Upvotes: 0

Views: 272

Answers (1)

Steffen Ullrich
Steffen Ullrich

Reputation: 123320

The order of bytes in an UDP packet is left unchanged. While UDP is not a reliable protocol the duplicates, reordering or packet loss happen only for whole packets but not for single bytes inside a packet.

Upvotes: 3

Related Questions