According to the Javadoc for DatagramChannel the receive method:
public abstract SocketAddress receive(ByteBuffer dst)
throws IOException
may return null if the DatagramChannel is in non-blocking mode. Other than changing to blocking mode is there a way to ensure I get the SocketAddress for the data I read?
may return null if the DatagramChannel is in non-blocking mode.
Returns ...
null
if this channel is in non-blocking mode and no datagram was immediately available.
If it returned null there was no data read. The situation corresponds to SocketChannel.read()
returning zero.