Do I run it in a command line? Do I run it as a GUI application? I think it discovers resources available through a local network and assigns addresses to the resources. What happens next? Is this information written to some file which I can read by other application? Can I put addresses generated by zeroconf into the address line of my browser and reach the web server (under condition that a web server is running on the resource)?
Typically each machine that offers a service will run a Zeroconf daemon, and clients will search for that on the network. On this Debian box, for instance, there's a process called
avahi-daemon
. To advertise a service, a program talks to the daemon. An easy way to do that is with the programavahi-publish
, which registers a service with the daemon:Until that program terminates,
avahi-browse
will find it:Most of the time you won't want to run a separate program just to publish the service, so your daemon will have a bit of code to do it. Here are some nice examples of how to do it in Python. There's a simple function which you call like this:
Again, most of the time you don't have to run avahi-browse, because your browser can probably find these things for itself. Safari can on the Mac, for example - look for the "Bonjour" menu.
You can also find machines using zeroconf. My machine is addressible using the
.local
domain:will work even if the machine isn't in DNS. Very useful for a home network!