简体   繁体   中英

Why do the UDP recipient receive the same packet in twice?

Why do the UDP recipient recevie the same packet in twice? The UDP sender just send one packet to the recipient, but the recipient receive the packet in twice and the two packet are same.The sender and recipient are runned in the differnt device.The sender APP is runned in the android device and the receipient is runned in the iOS device. How to explain this case and how to fix it?

From http://en.wikipedia.org/wiki/User_Datagram_Protocol

UDP uses a simple transmission model with a minimum of protocol mechanism.
It has no handshaking dialogues, and thus exposes any unreliability of the
underlying network protocol to the user's program. As this is normally IP
over unreliable media, there is no guarantee of delivery, ordering or
duplicate protection.

If you want to avoid such scenarios, you'll have to use TCP instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM