Results 1 to 1 of 1
- 04-10-2009, 06:31 AM #1
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
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:Java Code:MulticastSocket s = new MulticastSocket(); byte buf[] = ... (my data buffer) // Group is 225.192.3.3 for one sender, and 224.192.1.1 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();
The problem is, if I join 225.192.3.3, I still get messages targeted for 224.192.1.1, and vice versa.Java Code:MulticastSocket s = new MulticastSocket(port); //port = 64000 s.joinGroup(InetAddress.getByName(group)); //225.192.3.3 for one, and 224.192.1.1 for another byte buf[] = new byte[1024]; 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?
Similar Threads
-
First Group Project!!!!!!!!
By Zosden in forum Advanced JavaReplies: 28Last Post: 11-02-2010, 09:30 AM -
Group Demonstration
By Java Tip in forum SWTReplies: 0Last Post: 07-11-2008, 04:47 PM -
Group Projects
By Zosden in forum Advanced JavaReplies: 11Last Post: 06-03-2008, 03:47 AM -
New To The Group
By javarishi in forum IntroductionsReplies: 5Last Post: 04-10-2008, 04:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks