How do I build a DNS Query record in Erlang? <p>I am building a native Bonjour / Zeroconf library and need to build DNS query records to broadcast off to the other machines. I have tried looking thru the Erlang source code but as I am relatively new to Erlang it gets kind of dense down the bowels of all the inet_XXX.erl and .hrl files. I have a listener that works for receiving and parsing the DNS record payloads, I just can't figure out how to create the query records. What I really need to know is what I need to pass into inet_dns:encode() to get a binary I can send out. Here is what I am trying to do.</p> <pre><code>{ok,P} = inet_dns:encode(#dns_query{domain="_daap._tcp.local",type=ptr,class=in}) </code></pre> <p>here is the error I am getting</p> <pre><code>10&gt; test:send(). ** exception error: {badrecord,dns_rec} in function inet_dns:encode/1 in call from test:send/0 11&gt; </code></pre>