Multisocket - how to count how many datagram packets are coming up
<p>So I am sending audio over UDP via multicast.
And the sender is sending a raw audio UDP packet every 10 ms. Unfortunately every now and then it misses a packet. So what I did was try to time the send/receive so that I can work out if I have missed one.</p>

<p>Here is what I currently have: </p>

<pre><code>prevReceived = System.currentTimeMillis();
                    socket.receive(recv);
                    long messageReceived = System.currentTimeMillis();
if (dateDiff &gt; 20) {
 ... Missed packet add the previous packet
</code></pre>

<p>The problem that I am having is that sometimes the java multisocket receive method is taking 70ms to receive a message. But when I check with Microsoft network monitor the sending is still sending messages. </p>

<p>So I was wondering if there is a way to look at if the multisocket object has any pending packets: socket.count() or something.
or does the datagrampacket received time from the socket time. eg something like recv.timestamp().</p>

<p>So far I have not found anything and cannot work out why it is taking 70ms to process the message when Microsoft network monitor is processing it every 10 ms.</p>
