0

我的应用程序使用 UDP 的多播功能。

简而言之,我正在使用 java 并希望使用单个多播地址和端口传输所有数据。尽管多播侦听器将在逻辑上分为子组,这些子组可以在运行时更改并且可能不希望处理来自其组之外的数据。

为了实现这一点,我编写了代码,以便应用程序的所有运行实例将加入相同的多播组和端口,但会仔细观察数据包的发送者以确定它是否属于它们的子组。

警告我的应用程序的最小数据包大小为 30000-60000 字节!!!!!!

将使用 MulticastSocket.receive(DatagramPacket) 读取每个数据包并确定其所需的数据包是否会导致过多的开销(甚至缓冲区溢出)。

它会因为每个数据包都发送给每个人而产生大量流量导致网络拥塞吗?

4

2 回答 2

1

Every packet is not sent to everyone since multicast (e.g. PIM) would build a multicast tree that would place receivers and senders optimally. So, the network that would copy the packet as and when needed. Multicast packets are broadcasted (technically more accurate, flooded at Layer2) at the final hop. IGMP assists multicast at the last hop and makes sure that if there is no receiver joining in the last hop, then no such flooding is done.

"and may not wish to process data that comes from outside of their group." The receive call would return the next received datagram and so there is little one can do to avoid processing packets that are not meant for the subgroup classification. Can't your application use different multiple groups?

于 2013-08-24T07:27:17.467 回答
0

每个数据包可能会发送给每个人,但每个数据包只会在网络上出现一次。

但是,除非此应用程序完全在您控制的 LAN 中运行,包括所有路由器,否则它已经非常不可行。一旦通过不受控制的路由器,通常接受的最大 UDP 数据报大小为 534。

于 2013-08-24T07:07:42.053 回答