Clone wiki

filesnake / AvahiNotes

Avahi Notes

Avahi is an open source implementation of the Zeroconf protocol. I'm using that protocol to let the computer in the LAN to discover each others.

Unfortunately avahi and the dbus services related are not well documented, I'm finding throught intensive googling some interesting scripts and resources.

One of the thing that I want to do is to develop a clean API (and document it) to interact with avahi. In the project there are some useful scripts, expecially snippets/avahi/ .

Possible design of the zeroconf API

The dbus/avahi implementation is asyncronous, you should request the "avahi" services form dbus and through callback system you receive finally the information of the address, the name , type etc.. of the services you're trying to discovery.

A "twistish" code that uses the api would be something like:

class ClassThatNeedServices(AvahiBrowser):
      def on_service_discovered(self, address, port, name):
      	  # do whatever you want with the info obtained

A "pygtkish" one would be with signals, you register a signal that's triggered when there's some service discovered.

Maybe the "twistish" one is better, since it can be used say, with a QT backend or so.