title: Qt UDP mDNS response packet, not structured right
body: <p>I am trying to send out a Proper mDNS response packet using QUdpSocket. The trouble I am having is creating the packet correctly. Could someone please show me the proper way to put together the packet.</p>
  
  <p>So far this has not worked:</p>
  
  <pre><code>    QByteArray datagram;
      QDataStream out(&amp;datagram, QIODevice::WriteOnly);
  out &lt;&lt; 0x8400; //set standard query
  
      out &lt;&lt; 0; //Reply code: no error;
      out &lt;&lt; 0; //Questions; 0
      out &lt;&lt; 0; //Answers; 0
      out &lt;&lt; 1; //Authoritive answers: 0
      out &lt;&lt; 0; //Additional RR;
  
      QByteArray name("_home-sharing._tcp.local");
      out &lt;&lt;  name;
      out &lt;&lt; 0x000c; //PTR
      out &lt;&lt; 1;//Class: IN
      out &lt;&lt; 1;//Cache Flush
      out &lt;&lt; 0; //Time to Live: 0;
  </code></pre>
  
  <p>Then i send the datagram, any help would be appreciated.
  Thanks</p>