Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

AnyEvent::DNS for mDNS queries?

by creeble (Sexton)
on Apr 24, 2012 at 23:56 UTC ( #966965=perlquestion: print w/replies, xml ) Need Help??
creeble has asked for the wisdom of the Perl Monks concerning the following question:

I want to use AnyEvent::DNS to do mDNS queries. I tried AnyEvent::mDNS, but it is apparently quite broken, as AnyEvent::Handle doesn't do udp sockets.

I'm looking at the code from AnyEvent::mDNS and trying to figure out how to splice it into/subclass AnyEvent::DNS. I know, for example, that AnyEvent::DNS needs to be subclassed in at least a couple of places where it has the port hard-coded as 53 (want 5353 for mDNS).

But after that, I'm getting super lost -- I know that the query is multicast to, is this the server address? And I know I want a PTR record, and I think I can pack up the actual data request with:

$pkt = AnyEvent::DNS::dns_pack({rd => 1, qd => [ [sprintf ('_%s._tcp.local', $service), 'PTR'] +] });
but where does this $pkt get used in AnyEvent::DNS's API?


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://966965]
Approved by sundialsvc4
Front-paged by Tanktalus
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2017-12-17 10:24 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (463 votes). Check out past polls.