How to tell if datagram packet arrived without calling receive?
<p>I'm using UDP for the first time and I'm wondering if there is a way to find out if a packet has arrived without calling receive on a Java 7 <code>DatagramSocket</code>. </p>

<p>I'm trying to set up my client so that it can send multiple packets to a server and after each packet sent, check to see if a response has come in from the server.</p>

<p>Right now I am just using the <code>setSoTimeout</code> method on the <code>DatagramSocket</code> to set the timeout to 1 milisecond, but I would rather not wait at all if it is possible. </p>

<p>Update:</p>

<p>I ended up learning about the java.nio package and was able to use that nonblocking api to do this.</p>
