简体   繁体   English

多播的替代方法

[英]Alternatives to multicast

I'm currently developing a server (using Java) that has to send quite often (every 10-30 seconds) a few bytes to multiple clients (10 - 100). 我目前正在开发服务器(使用Java),该服务器必须经常(每10-30秒)向多个客户端(10-100)发送几个字节。 At first, I thought of using UDP multicast datagrams (java.net.MulticastSocket), but I thought of this not being a good solution because of the bad support for multicast on most routers. 最初,我考虑使用UDP多播数据报(java.net.MulticastSocket),但由于大多数路由器对多播的支持不佳,因此我认为这不是一个好的解决方案。

So I'm wondering if it would be a good idea if I sent all data directly to the hosts via unicast or do you know of anything more elegant/with less traffic? 因此,我想知道是否可以通过单播将所有数据直接发送到主机,还是您知道更优雅/流量更少的东西,这是否是一个好主意?

There are many advantages in using JMS, but most of these use TCP and so could you. 使用JMS有许多优点,但是其中大多数都使用TCP,因此您也可以。 A few bytes every 10-30 seconds to a few hundred clients is small even on low bandwidth networks. 即使在低带宽网络上,每10-30秒到几百个客户端的几个字节也很小。

Say you send a 100 bytes message to 100 clients every 10 seconds, That 1000 bytes per second or 8Kbits/second. 假设您每10秒向100个客户端发送一条100字节的消息,即每秒1000字节或8Kbits /秒。 Even 3G networks will support this bandwidth easily. 甚至3G网络也将轻松支持此带宽。 ie you could do this with a smart phone. 即,您可以使用智能手机来执行此操作。 ;) ;)

The simplest approach may be to have a tcp connection from each client which the server sends update messages as required. 最简单的方法可能是从每个客户端建立tcp连接,服务器根据需要发送更新消息。

Have you considered using a message queue such as Active MQ ? 您是否考虑过使用诸如Active MQ之类的消息队列? These have the nice characteristic that you write the message once to the queue and you can have as many readers as you like reading the queue. 这些具有很好的特性,即您只将消息写入队列一次,并且您可以拥有尽可能多的阅读器来阅读队列。

You can also use a gossip-based application-level multicast protocol. 您还可以使用基于八卦的应用程序级多播协议。 For instance, NeEM will scale easily to 100 destinations while providing an interface similar to MulticastSocket and using just TCP/IP, thus being compatible with less than optimal network setups. 例如, NeEM将轻松扩展到100个目的地,同时提供类似于MulticastSocket的接口并仅使用TCP / IP,因此与不太理想的网络设置兼容。

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

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