简体   繁体   English

为什么UDP收件人两次收到相同的数据包?

[英]Why do the UDP recipient receive the same packet in twice?

Why do the UDP recipient recevie the same packet in twice? 为什么UDP收件人会在两次收到相同的数据包? 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. UDP发送方只是向接收方发送一个数据包,但接收方接收数据包两次,两个数据包相同。发送方和接收方在不同的设备上运行。发送方APP在Android设备上运行,收件人是在iOS设备上运行。 How to explain this case and how to fix it? 如何解释此案例以及如何解决?

From http://en.wikipedia.org/wiki/User_Datagram_Protocol 来自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. 如果您想避免这种情况,则必须使用TCP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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