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.
So far this has not worked:
QByteArray datagram;
QDataStream out(&datagram, QIODevice::WriteOnly);
out << 0x8400; //set standard query
out << 0; //Reply code: no error;
out << 0; //Questions; 0
out << 0; //Answers; 0
out << 1; //Authoritive answers: 0
out << 0; //Additional RR;
QByteArray name("_home-sharing._tcp.local");
out << name;
out << 0x000c; //PTR
out << 1;//Class: IN
out << 1;//Cache Flush
out << 0; //Time to Live: 0;
Then i send the datagram, any help would be appreciated. Thanks