[Twisted-Python] [Q] Naming Service for Twisted Servers

David Ripton dripton at ripton.net
Sat Jan 10 14:27:35 EST 2009

On 2009.01.09 23:06:46 -0500, V S P wrote:
> What is ZeroConf?  Can you please point me to the project page
> (I searched for some but did not find something twisted/python
> specific).

ZeroConf is the generic protocol name, not a particular project.  The
most popular implementations are Bonjour and Avahi.  Both are portable
and open source.  Macs ship with Bonjour.  Avahi seems more popular on

In theory, it's pretty easy to use Avahi from Python.  Avahi is a C
daemon that always runs and does all the network stuff.  It shares
information with other programs via DBus.  Your Python program can
interact with the information using dbus-python.  dbus-python features
an asynchronous interface that should work great with Twisted.

In practice, it all ends in tears because dbus-python is one big
Heisenbug.  After about 18 months with mostly-working service discovery,
we finally gave up on it and wrote our own custom service discovery
protocol.  (Which works well, but doesn't help you because it's
proprietary and IPv6.)

Bonjour appears to have Python bindings; maybe you can try those.  Or
maybe a newer version of dbus-python actually works reliably.

But if not, it's not hard to write your own simple service discovery
protocol.  Create a common multicast group that all your clients listen
to, and that all your servers send a packet of service information to
every few seconds.  Most of the complexity in ZeroConf is about
minimizing the combination of latency and network traffic, so if you
don't need low latency or don't mind a bit more traffic then a simpler
protocol will work fine.

David Ripton    dripton at ripton.net

More information about the Twisted-Python mailing list