public void read(MulticastSocket msocket, byte[] inbuf) { try { DatagramPacket packet = new DatagramPacket(inbuf, inbuf.length); // Wait for packet msocket.receive(packet); // Data is now in inbuf int numBytesReceived = packet.getLength(); } catch (IOException e) { } }