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). At first, I thought of using UDP multicast data开发者_开发百科grams (java.net.MulticastSocket), but I thought of this not being a good solution because of the bad support for multicast on most routers.
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. A few bytes every 10-30 seconds to a few hundred clients is small even on low bandwidth networks.
Say you send a 100 bytes message to 100 clients every 10 seconds, That 1000 bytes per second or 8Kbits/second. Even 3G networks will support this bandwidth easily. i.e. 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.
Have you considered using a message queue such as 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.
精彩评论