import java.net.DatagramPacket;
import java.net.MulticastSocket;
public class Main {
public static void main(String[] argv) throws Exception {
MulticastSocket msocket = new MulticastSocket(9999);
byte[] inbuf = new byte[1024];
DatagramPacket packet = new DatagramPacket(inbuf, inbuf.length);
msocket.receive(packet);
// Data is now in inbuf
int numBytesReceived = packet.getLength();
}
}