Sending UDP broadcast, receiving multiple messages

后端 未结 4 643
借酒劲吻你
借酒劲吻你 2020-11-30 22:52

I\'ve got 2 programs, 1 for sending an UDP broadcast message and 1 that is listening for this broadcast. My problem is that sometimes when I send a broadcast, the receiver r

4条回答
  •  佛祖请我去吃肉
    2020-11-30 23:15

    UDP packets aren't reliable, it's totally possible that you'll get the same packet twice or even none at all, when using udp you need to include some kind of unique ID in your data so you can discard errors or request a resend.

提交回复
热议问题