title: dropped frames over UDP
body: <p>this is my first "question", I hope I do it right :)</p>
  
  <p>I am experimenting with network programming and in particular I want to broadcast data from one machine to some other >10 devices using UDP, over a wireless network. The data comes in packets of about 300 bytes, and at about 30 frames per second, i.e., one every ~33ms. 
  My implementation is based on the qt example: <a href="http://qt-project.org/doc/qt-4.8/network-broadcastreceiver.html" rel="nofollow">http://qt-project.org/doc/qt-4.8/network-broadcastreceiver.html</a></p>
  
  <p>I am testing the application with just one client and experiencing quite a few dropped frames, not really sure why. All works fine if I used ethernet cables. I hope someone here can help me find a reason.</p>
  
  <p>I can spot dropped frames because the packets contain a timestamp: After I receive one datagram, I can check for the difference between its timestamp and the last one received, if this is greater than e.g. 50ms, it means that I lost one packet on the way.
  This happens quite often, even though I have a dedicated wi-fi network (not connected to the internet and with just 3 machines connected to a router I just bought). Most of the times I drop one or two packets, which would not be a problem, but sometimes the difference between the timestamps suggests that some >30 packets are lost, which is not good for what I am trying to achieve.</p>
  
  <p>When I ping from one machine to the other, I get these values:</p>
  
  <pre><code>50 packets transmitted, 50 packets received, 0.0% packet loss
  round-trip min/avg/max/stddev = 1.244/91.405/508.959/119.074 ms 
  </code></pre>
  
  <p>pretty bad for a new router, in a dedicated network with just 3 clients, isn't it? The router is advertised as a very fast Wi-Fi router, with three times faster performance than 802.11n routers.</p>
  
  <p>Compare it with the values I get from an older router, sitting in the same room, with some 10 machines connected to it, during office hour:</p>
  
  <pre><code>39 packets transmitted, 39 packets received, 0.0% packet loss
  round-trip min/avg/max/stddev = 1.458/47.297/142.201/37.186 ms 
  </code></pre>
  
  <p>Perhaps the router is defective?</p>
  
  <p>One thing I cannot explain is that, if I ping while running my UDP client/server application, the statistics improve:</p>
  
  <pre><code>55 packets transmitted, 55 packets received, 0.0% packet loss
  round-trip min/avg/max/stddev = 1.164/6.174/197.962/26.181 ms 
  </code></pre>
  
  <p>I was wondering if anyone had tips on what to test, hints on how to achieve a "reliable" UDP connection between these machines over wi-fi. By reliable I mean that I would be ok dropping 2 consecutive packets, but not more. </p>
  
  <p>Thanks.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>It seems that the router (?) sends the packets in bursts. I am measuring the time it passes between receiving two datagrams on the client and this value is about 3 ms for a sequence of ~10 packets, and then, around 300 ms for the next packet. I think my issues at the client is more related to this inconsistency in the intervals between frames, rather than the dropped frames. I probably just need to have a queue and a delay of >300ms wrt to the server.</p>