File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to implement multicasting in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to implement multicasting in java?" Watch "how to implement multicasting in java?" New topic
Author

how to implement multicasting in java?

Kavita Shivani
Ranch Hand

Joined: Aug 14, 2009
Posts: 45
Hi everyone,
I am supposed to create a small multicast application. Multicasting is a new topic for me.
The requirement is that, I have a multicast server, few clients connected to it who are interested in some of the topics that the server multicasts. Each one of this client can register themselves to get information on each of the topics, using the topic ID. So I wanted to know if I can group these clients into one multicast address group and send the packets. If I do this, I will have to use a few InetAddresses, each representing a group address to which subset of the clients will register to. But this will increase as the number of topics increase. So my question is am I doing it the right way? Or is it that my multicast server will always have one multicast group address and I need to have a proper logic to seggregate the clients that wants to receive the information on topics they are interested in. I am not sure how do I design this.

Thank you,
Kavitha.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11480
    
  16

search around for the Publish/Subscribe design pattern. it may help guide you in your design.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Rok Štelcer
Ranch Hand

Joined: Nov 03, 2009
Posts: 101
fred rosenberger wrote:search around for the Publish/Subscribe design pattern. it may help guide you in your design.

Or in other words: Observer pattern.

Regards,
Rok


SCJP, SCWCD
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1824
    
    7

Have you looked at JMS yet? Seems to me that a standard multicast JMS solution using topics would suit your needs pretty well.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to implement multicasting in java?