[Twisted-Python] Twisted and Rendezvous

screwtape at froup.com screwtape at froup.com
Fri Aug 1 04:06:03 EDT 2003

On Wed, Jul 30, 2003 at 02:56:47PM -0700, Brian Warner wrote:
> screwtape at froup.com writes:
> > A few weeks ago, someone on the list mentioned Rendezvous support for
> > Twisted. Curious, I picked up the Rendezvous specification documents,
> > and got to hacking.
> That's cool. I'm not sure this falls into the same scope, but it occurred to
> me that it would be handy to have a DNS server that provided SRV records
> based upon registrations arriving from other server programs. If the
> application (say, an HTTP server) launched, started listening on an
> arbitrary port, then told the DNS/SRV server its service name and port
> number, the DNS server could start feeding appropriate SRV records for the
> application.

Having a nice standard structure for SRV records is the purposes of
the DNS-SD specification: http://tinyurl.com/ipj7

It turns out that a service like what you describe is going to be
quite important for anyone who wants to write software that uses
Rendezvous and doesn't require Mac OS X - as far as I can tell, only
one application at a time per host can bind to a particular port on a
multicast address, so if the OS doesn't supply an mDNS responder (or
your language doesn't have bindings for the OS's mDNS responder) then
applications will try and supply their own, and if two or more such
applications try and run simultaneously, problems will occur.

Thus some kind of server that sits on the network and offers mDNS
services to applications who otherwise can't offer them, possibly
working as a regular DNS server as well (configure it as the DNS
server for the '.local' domain to make legacy apps magically look up
multicast-DNS based host-names) would be an absolute boon.

Note that you only need a multicast DNS proxy to serve DNS records -
if another process on your host has already bound to the mDNS address
and port, you can look up multicast DNS records by sending ordinary
DNS packets to the mDNS port. In Twisted, it looks like this:

	from twisted.names import client

	resl = client.Resolver(servers=[('', 5353)])

> I'd have the application keep a TCP connection open to the DNS server, and
> if that connection went down, the SRV record would be removed. It would work
> a lot like dynamic DNS, except per-application instead of per-host.

The DNS-SD documentation mentions (in passing) various other
ways of updating DNS rather than multicast DNS - manual update,
scripts that use protocol-specific browsing to create a standard DNS
zone file, or (as you mention) RFC 2136, Dynamic DNS Update.

I had a brief, 20-second glance at the dynamic DNS RFC, and I can't
see any reason you shouldn't be able to send per-application records
to a dynamic DNS server. You'd still have hassles with cooperatively
maintaining DNS records and so forth, of course...

I like the idea of having a TCP connection alive (with keepalive
packets, I assume) to maintain one's DNS records. You should be able
to supply more than one record, of course (DNS-SD requires that you
serve up a PTR record and a TXT record along with your SRV record),
so the wire protocol might be a bit more complex.

Hmm.. how stable and extensible and reliable is twisted.names?

> just looking to plant some idea seeds..
>  -Brian

Always welcome. :)

 ___________ ___________________________________
| Screwtape | http://livejournal.com/~thristian |______ _____ ___ __ _  _   _    _
| "We've got a lot in common" "I've always thought so, too." -- M*A*S*H

More information about the Twisted-Python mailing list