1

This code works with this address "228.5.6.7", but not with this one "FF7E:230::1234" (devices used: Samsung S4 & TabA).

// join a Multicast group and send the group salutations
 String msg = "Hello";
 InetAddress group = InetAddress.getByName("228.5.6.7");
 MulticastSocket s = new MulticastSocket(6789);
 s.joinGroup(group);

 DatagramPacket hi = new DatagramPacket(msg.getBytes(), msg.length(), group, 6789);
 s.send(hi);

 // get their responses!
 byte[] buf = new byte[1000];
 DatagramPacket recv = new DatagramPacket(buf, buf.length);
 s.receive(recv);

 // OK, I'm done talking - leave the group...
 s.leaveGroup(group);

I tried this example too, it gave me the same result. Impossible to know if the problem happens when the group is joined or when the DatagramPacket is sent.

Greelings
  • 4,964
  • 7
  • 34
  • 70

0 Answers0