Avahi 0.1 Finally Released
We finally released Avahi 0.1 (http://www.freedesktop.org/Software/Avahi). Full release announcement here (http://bur.st/~lathiat/avahi/announcement-0.1). 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) gobject.MainLoop().run()
This short program will connect to running avahi-daemon and browse for web services.