Multicast group seems to be a noop
I have written an application which uses multicast so that portions of the application can find eachother on a network without the need for a bunch of preconfiguration. The problem I'm seeing, is that the reciver code receives the Datagram packets for every group, rather than just the one it's joined. I'm using java 6_10.
Here's the notional snippet from the sender:
Here is notional code from the receiver:
MulticastSocket s = new MulticastSocket();
byte buf = ... (my data buffer)
// Group is 126.96.36.199 for one sender, and 188.8.131.52 for another
// port = 64000 in both cases, although, sender does not need
// to join the group
DatagramPacket pack = new DatagramPacket(buf, buf.length, InetAddress.getByName(group), port);
The problem is, if I join 184.108.40.206, I still get messages targeted for 220.127.116.11, and vice versa.
MulticastSocket s = new MulticastSocket(port); //port = 64000
s.joinGroup(InetAddress.getByName(group)); //18.104.22.168 for one, and 22.214.171.124 for another
byte buf = new byte;
DatagramPacket pack = new DatagramPacket(buf, buf.length);
Is this how multicast is supposed to work (seems kind of stupid since groups are totally irrelevant if so), is it a Java bug possibly, or are there dumb things a sys admin can do to configure things to cause this to happen?