UDP generally does not have wrong data

insert image description here
UDP will lose packets during transmission, but it will not cause data confusion, which involves the characteristics and working principle of UDP protocol.

  1. No connection: UDP is a connectionless transmission protocol, each UDP packet is independent and has no dependencies. Therefore, even if packet loss occurs, the receiver will not misunderstand the relationship between the lost packet and other packets, and will not cause data confusion.

  2. Disorder: The receiving order of UDP packets has nothing to do with the sending order, and may arrive at the receiver in a different order. However, since the UDP application layer needs to deal with the order of data packets by itself, the receiver can restore the correct order of data through identifiers or serial numbers, thereby avoiding data confusion.

  3. Packet loss: The UDP protocol may encounter packet loss during transmission, such as network congestion, transmission errors, or routing problems. When data packets are lost, the receiver cannot obtain these lost data packets, but it will not cause the received data to be garbled.

To sum up, the connectionless and disordered nature of UDP makes the loss of data packets not cause data confusion. The receiver either receives the UDP packet in its entirety, or not at all. For the application layer, it needs to deal with the order of the data packets by itself and ensure the correctness and integrity of the data.
insert image description here

Guess you like

Origin blog.csdn.net/qq_33471732/article/details/132252904