Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
some experimental sending code, this will change
Browse files Browse the repository at this point in the history
but it demo's how to broadcast data to the multi-
cast group
  • Loading branch information
jarrodhroberson committed Mar 9, 2010
1 parent fa2efa5 commit deba6bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/inet_mdns.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ send() ->
D = "test@" ++ HN ++ "._test._tcp.local",
R = #dns_rr{domain="_test._tcp.local",type=ptr,ttl=4500,data=D},
Rec = #dns_rec{header=H,anlist=[R]},
{ok,S}=gen_udp:open(0,[]),
{ok,S}=gen_udp:open(?PORT,[{ip,{192,168,0,105}}]),
inet:setopts(S, [{reuseaddr,true},{broadcast,true}]),
gen_udp:send(S,?ADDR,?PORT,inet_dns:encode(Rec)).

Expand All @@ -27,7 +27,7 @@ get_timestamp() ->

start() ->
%% start the process listening for mdns messages
{ok,S} = gen_udp:open(?PORT,[{reuseaddr,true},{ip,?ADDR},binary]),
{ok,S} = gen_udp:open(?PORT,[{reuseaddr,true},{ip,{192,168,0,105}},binary]),
inet:setopts(S,[{add_membership,{?ADDR,{0,0,0,0}}}]),
Pid=spawn(?MODULE,receiver,[dict:new()]),
gen_udp:controlling_process(S,Pid),
Expand Down

0 comments on commit deba6bb

Please sign in to comment.