[ann] net-mdns-0.1 - multicast DNS and DNS service discovery

S

Sam Roberts

This is a complete rewrite of net-mdns-0.0. The major additions are a
mDNS responder (thus ability to advertise services) and a
DNSSD-compatible high-level API.

Only tested on Mac OS X 10.3. Multicast socket options and behaviours
vary across different operating systems. It will take some tweaking, I'm
sure, so I would appreciate feedback from people with other kinds of
systems.

Cheers,
Sam

-- stuff ripped from the on-line documentation --

Where?

Homepage:: http://dnssd.rubyforge.org/net-mdns
Download:: http://rubyforge.org/frs/?group_id=316

What?

An implementation of a multicast DNS (mDNS) responder. mDNS is an
extension of hierarchical, unicast DNS to link-local multicast, used to
do service discovery and address lookups over local networks. It is
most widely known because it is part of Apple's OS X.

net-mdns consists of:
- Net::DNS::MDNSSD: a high-level API for browsing, resolving, and advertising
services using DNS-SD over mDNS that aims to be compatible with DNSSD, see
below for more information.
- Resolv::MDNS: an extension to the 'resolv' resolver library that adds
support for multicast DNS.
- Net::DNS::MDNS: the low-level APIs and mDNS responder at the core of
Resolv::MDNS and Net::DNS::MDNSSD.

net-mdns can be used for:
- name to address lookups on local networks
- address to name lookups on local networks
- discovery of services on local networks
- advertisement of services on local networks


Example?

# Advertise a webrick server over mDNS.

require 'webrick'
require 'net/dns/mdns-sd'

DNSSD = Net::DNS::MDNSSD

class HelloServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, resp)
resp.body = "hello, world\n"
resp['content-type'] = 'text/plain'
raise WEBrick::HTTPStatus::OK
end
end

server = WEBrick::HTTPServer.new( :port => 8080 )

server.mount( '/hello/', HelloServlet )

handle = DNSSD.register("hello", '_http._tcp', 'local', 8080, 'path' => '/hello/')

['INT', 'TERM'].each { |signal|
trap(signal) { server.shutdown; handle.stop; }
}

server.start


How does it compare to the DNSSD project?

The DNS-SD project at http://dnssd.rubyforge.org is another
approach to mDNS and service discovery.

DNS-SD is a compiled ruby extension implemented on top of the dns_sd.h APIs
published by Apple. These APIs work by contacting a local mDNS daemon
(through unix domain sockets) and should be more efficient since they
use a daemon written in C by a dedicated team at Apple.

Currently, the only thing I'm aware of net-mdns doing that DNS-SD
doesn't is integrate into the standard library so that link-local domain
names can be used throughout the standard networking classes, and allow
querying of arbitrary DNS record types. There is no reason DNS-SD can't
do this, it just needs to wrap DNSServiceQueryRecord() and expose it, and
that will happen sometime soon.

Since net-mdns doesn't do significantly more than DNSSD, why would you be
interested in it?

The DNS-SD extension requires the dns_sd.h C language APIs for the Apple
mDNS daemon. Installing the Apple responder can be quite difficult, and
requires a running daemon. It also requires compiling the extension. If
you need a pure ruby implementation, or if building DNS-SD turns out to be
difficult for you, net-mdns may be useful to you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top