Results 1 to 1 of 1
- 04-10-2009, 06:31 AM #1Senior Member
- Join Date
- Jan 2009
- Rep Power
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:
MulticastSocket s = new MulticastSocket(); byte buf = ... (my data buffer) // Group is 22.214.171.124 for one sender, and 126.96.36.199 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); s.send(pack); s.close();
MulticastSocket s = new MulticastSocket(port); //port = 64000 s.joinGroup(InetAddress.getByName(group)); //188.8.131.52 for one, and 184.108.40.206 for another byte buf = new byte; DatagramPacket pack = new DatagramPacket(buf, buf.length); s.receive(pack); s.leaveGroup(InetAddress.getByName(group)); s.close();
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?
- By Zosden in forum Advanced JavaReplies: 28Last Post: 11-02-2010, 09:30 AM
- By Java Tip in forum SWTReplies: 0Last Post: 07-11-2008, 04:47 PM
- By Zosden in forum Advanced JavaReplies: 11Last Post: 06-03-2008, 03:47 AM
- By javarishi in forum IntroductionsReplies: 5Last Post: 04-10-2008, 04:34 AM