code: private boolean isPacketLongEnough(DatagramPacket packet, int expectedLength, String name) {
          final int length = packet.getLength();
          if (length < expectedLength) {
              logger.warn("Ignoring too-short " + name + " packet; expecting " + expectedLength + " bytes and got " +
                      length + ".");
              return false;
          }
  
          if (length > expectedLength) {
              logger.warn("Processing too-long " + name + " packet; expecting " + expectedLength +
                      " bytes and got " + length + ".");
          }
  
          return true;
      }
docs: Helper method to check that we got the right size packet.
  
  @param packet a packet that has been received
  @param expectedLength the number of bytes we expect it to contain
  @param name the description of the packet in case we need to report issues with the length
  
  @return {@code true} if enough bytes were received to process the packet