Posted on Mo 22 August 2005

Avahi 0.1 Finally Released

We finally released Avahi 0.1. Full release announcement here. Avahi comes with a powerful DBUS API. Just two show off the coolnes of that interface a Python example:

import avahi, dbus, gobject

bus = dbus.SystemBus()
server = dbus.Interface(bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)

def new_service(interface, protocol, name, type, domain):
	print "Found service '%s' of type '%s' in domain '%s'" % (name, type, domain)

def remove_service(interface, protocol, name, type, domain):
	print "Service '%s' of type '%s' in domain '%s' disappeared." % (name, type, domain)

path = server.ServiceBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "_http._tcp", "")
b = dbus.Interface(bus.get_object(avahi.DBUS_NAME, path), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
b.connect_to_signal('ItemNew', new_service)
b.connect_to_signal('ItemRemove', remove_service)

This short program will connect to running avahi-daemon and browse for web services.

© Lennart Poettering. Built using Pelican. Theme by Giulio Fidente on github. .