title: UDP Receiver code only receiving one packet
body: <p>Th following code only receives on packet of data.  I have sent different sizes of data to see if data is being received on the receiver.  I only get the first packet and I do not see any other packets.  What could be the cause of the missing packets.  Since I am receiving 12 bytes every time.  Do I need to clear the buffer or make it larger. What practices should I follow. </p>
  
  <pre><code>import java.net.DatagramSocket;
  import java.net.DatagramPacket;
  import java.io.IOException;
  import java.nio.ByteBuffer;
  import java.nio.ByteOrder;
  
  public class Reciever {
    public static void main(String[] args) {
      try {
        DatagramSocket s = new DatagramSocket(2010);
        byte[] data = new byte[12];
        DatagramPacket p = new DatagramPacket(data, 12);
        s.receive(p);
        System.out.println("got packet");
        ByteBuffer bb = ByteBuffer.allocate(12).order(ByteOrder.LITTLE_ENDIAN);
        bb.put(data);
        bb.rewind();
        System.out.println(bb.getFloat());
        System.out.println(bb.getFloat());
        System.out.println(bb.getFloat());
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }
  </code></pre>