[erlang-questions] Encoding a DNS Query correctly

Jarrod Roberson <>
Mon Nov 16 23:02:35 CET 2009


thanks for the responses I now have it working!

send(Domain) ->
    {ok,S} = gen_udp:open(5353,[{reuseaddr,true}, {ip,{224,0,0,251}},
{multicast_ttl,4}, {multicast_loop,false}, {broadcast,true}, binary]),
    P =
#dns_rec{header=#dns_header{},qdlist=[#dns_query{domain=Domain,type=ptr,class=
in}]},
    gen_udp:send(S,{224,0,0,251},5353,inet_dns:encode(P)),
    gen_udp:close(S).


More information about the erlang-questions mailing list