code: protected int handleDatagram (DatagramChannel listener, long when)
      {
          InetSocketAddress source;
          _databuf.clear();
          try {
              source = (InetSocketAddress)listener.receive(_databuf);
          } catch (IOException ioe) {
              log.warning("Failure receiving datagram.", ioe);
              return 0;
          }
  
          // make sure we actually read a packet
          if (source == null) {
              log.info("Psych! Got READ_READY, but no datagram.");
              return 0;
          }
  
          // flip the buffer and record the size (which must be at least 14 to contain the connection
          // id, authentication hash, and a class reference)
          int size = _databuf.flip().remaining();
          if (size < 14) {
              log.warning("Received undersized datagram", "source", source, "size", size);
              return 0;
          }
  
          // the first four bytes are the connection id
          int connectionId = _databuf.getInt();
          Connection conn = _connections.get(connectionId);
          if (conn != null) {
              ((PresentsConnection)conn).handleDatagram(source, listener, _databuf, when);
          } else {
              log.debug("Received datagram for unknown connection", "id", connectionId,
                        "source", source);
          }
  
          return size;
      }
docs: Called when a datagram message is ready to be read off its channel.