I've been reading the official DNS RFC (http://www.faqs.org/rfcs/rfc1035.html) and looking at articles like this that explain how DNS query packets are structured http://www.firewall.cx/dns-query-format.php but I'm having a hard time trying to combine the two and actually get to a point where I know what to do

Basically I know that I need to use UDP to send the query and there is only one type of query I actually want to perform - an MX lookup. So I'm hoping that means I dont need to account for a lot of things that anyone creating a complete DNS Resolver would need to implement.

The only experience I have with network communication like this is with protocols that are text based (and use TCP, but I dont think that makes much difference here, if anything UDP should be easier). DNS however is binary based and I just cant figure out how I would know what bytes to send down the wire for a specific MX query... I'll keep looking into it but if anyone has any ideas or suggestions on where to look then I would really appreciate it

Thanks
Chris