JxtaMulticastSocket: How to receive multiple messages?
JxtaMulticastSocket: How to receive multiple messages?
September 14, 2011 - 04:55
Hello,
I hope this is a simple question..
I am trying out JXTA by running some of the examples from the book "Practical JXTA II". I am currently looking at the JXTA Multicast Socket examples. I see the following code being used to receive a message:
byte[] buffer = new byte[1000];
DatagramPacket datagramPacket = new DatagramPacket(buffer, buffer.length);
multicastSocket.receive(datagramPacket);
String message = new String(datagramPacket.getData(), 0, datagramPacket.getLength());
As far as I can tell, this only gets one message. What would be the way to get all new messages from the multicast socket (the peer group)?
Thanks!
Frans




