Two things would need to be done. 1) Include pybonjour (MIT-licensed) and 2) write few lines of code to register a service with Bonjour.
From the end users perspective, Mac users are set. Bonjour is included in Mac OS X and Safari comes with a http service browser. Windows users would need to install Apple's Bonjour package to get the services browser plugin for Internet Explorer. Ubuntu comes with Avahi but pybonjour requires the Bonjour compatibility layer (libavahi-compat-libdnssd1) to be installed.
All this works in conjunction with the current networking system. So you can run your own DHCP, DNS, or manually add IP addresses in addition to using zeroconf.
pybonjour, Mirror
Code: Select all
#
# Example code to register http service with Bonjour
#
# It advertises http://hostname.local.:8080/
# instead of http://hostname.local:8080/sabnzbd/
#
import pybonjour, select
name = 'SABnzbd'
regtype = '_http._tcp'
port = int(8080)
def register_callback(sdRef, flags, errorCode, name, regtype, domain):
if errorCode == pybonjour.kDNSServiceErr_NoError:
print 'Registered service:'
print ' name =', name
print ' regtype =', regtype
print ' domain =', domain
sdRef = pybonjour.DNSServiceRegister(name = name,
regtype = regtype,
port = port,
callBack = register_callback)
try:
try:
while True:
ready = select.select([sdRef], [], [])
if sdRef in ready[0]:
pybonjour.DNSServiceProcessResult(sdRef)
except KeyboardInterrupt:
pass
finally:
sdRef.close()

