组播大数据包包含所有信息到多个客户端,而单个数据包则包含到目标客户端 [英] Multicasting big packet contain all info to multiple clients vs individual packets to targeted clients

查看:186
本文介绍了组播大数据包包含所有信息到多个客户端,而单个数据包则包含到目标客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个C ++应用程序MyMasterApp,该应用程序通过wifi将信息(通过UDP的OSC)发送到多个客户端(大约5-10个),这些客户端是移动设备(Android或iPhone).

I'm writing a C++ application MyMasterApp which sends information (OSC via UDP) to multiple clients (about 5-10), which are mobile devices (Android or iPhone) via wifi.

每个设备都将接收相同类型的唯一信息.每个设备大约100-200字节,我将以30Hz更新所有设备.

Each device is to receive unique information, of the same type. Probably about 100-200 bytes per device, and I'll be updating all devices at 30Hz.

我可以向每个设备发送一个唯一的数据包,或者我可以创建一个大结构,其中包含每个设备的每个数据的唯一位,并带有目标ID,将其组播到所有设备,然后每个设备只选择一个取出所需的数据.

I could send a unique data packet to each device, or I could create one big structure which contains each of the unique bits of data for each device, with the target id, multicast this to all devices, then each device only picks out the data it needs.

  • 将DATA1发送到device1
  • 将DATA2发送到device2
  • 将DATA3发送到device3
  • 将DATA4发送到device4

vs

  • 创建一个包含DATA1,DATA2,DATA3等的新DATA.将DATA组播到所有设备,每个设备选择要使用的相关数据.

在我尝试这两种方法之前,有没有一种理论上或记录上的一种相对于另一种的实践优势(例如,更好的性能,更少的冲突,丢失的数据包等)?还是差异可以忽略不计?

Before I attempt both approaches, are there any theoretical, or recorded practical advantages of one over the other (E.g. better performance, less collision, lost packets etc)? Or are the differences just negligible?

我对同一项目的相关网络性能问题有疑问 我应该在不同的端口还是在同一端口上侦听?

I have a related network performance question about the same project at Should I listen on different ports, or the same port?

推荐答案

即使不考虑未来的增长,您目前最糟糕的200字节x 10个设备的情况已经是2000字节,已经太大了,无法通过UDP发送.实际的最大UDP数据报通常保持为此类的576个字节或534个数字.所以你别无选择.您必须单播.

Even leaving future growth aside, your present worst cases of 200 bytes x 10 devices is already 2000 bytes, which is already too big to send via UDP. The practical maximum UDP datagram is generally held to be 576 bytes, or 534, numbers of that sort. So you don't have a choice. You must unicast.

这篇关于组播大数据包包含所有信息到多个客户端,而单个数据包则包含到目标客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆