Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm writing a code to work through sockets in java. I've created a multicast group to which anybody can join on the LAN. But the LAN has many different networks, operated by a router, and the multicast group created by the code would be different in different network and if a person multicast's something to the multicast group in the network A it will only be received by the people joined to the group in that network only, and not by all the people's in different networks.

For Example:

The multicast group is, let's say, 224.0.0.1. And the LAN has 2 different networks.

Network A = 172.22.28.0/255.255.254.0

Network B = 172.22.30.0/255.255.254.0

Then there will be two different multicast group, with the same address as 224.0.0.1, in the two different networks.

My problem is How can I multicast over these two diff. networks on the LAN through java?

As I was searching for the solution, I came across the concept of IP ENCAPSULATION, in which I can add an outer ip address to the packet, so that it can go through different networks. I think this should work as I can encapsulate the other network's address on the packet send.

Can somebody tell me that how can this(IP ENCAPSULATION) be implemented in java? If not, Is there any other method possible which I can apply.

Any help Appreciated.

share|improve this question

2 Answers 2

The solution that you're looking for is to implement Protocol Independent Multicast on the router.

This will turn your two distinct multicast groups into one big group. The router will then be tracking the members of the IGMP multicast group in both networks, and will send any traffic sent to the group to all members of the group, regardless of their network segment.

Oh, and one further note: stay away from 224.0.0.1; it's the all hosts group, and you'll get unexpected behavior if you use it.

share|improve this answer
    
but I do not have any access over the router, neither can i change any of it's settings. I have to do it by doing some programing at the user end itself. Do you have any answers to that ? –  pankaj Aug 19 '11 at 19:11

Yes, what you want is jgroups:

http://www.jgroups.org/javadoc/org/jgroups/protocols/TUNNEL.html

jgroups has several features that should make this easier. If you really want to encapsulate multicast groups on remote hosts you can use tunnel. However it might be better to use unicast for the remote hosts. You can do either (and even a mix) in jgroups.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.