This Time Self-Hosted
dark mode light mode Search

ZeroConf and VNC software

I used not to be a maintainer of the ZeroConf idea, but it changed drastically when I started using Mac OS X, that – if we ignore the hard fact that it’s a proprietary operating system – is a pretty good UNIX system where a lot of the configuration details are hidden to the basic users, which in my opinion is a good idea. I’m not a person to suggest always and everytime the hard way.

Being able to discover what is available on the network currently is not only interesting on public access networks like, say, schools where students are allowed to connect their laptops to the LAN, but also for small offices where servers might need to be replaced from time to time, or where printers might come and go out of the network depending on the supply of ink and paper available, as well as small home networks to check which boxes are on and which ones are off, and to see which services are running and which failed to start for instance.

It’s for this reason that I started the porting of nss-mdns to FreeBSD a month or two ago – but I wasn’t able to complete it myself for lack of time, a huge thanks goes to Bruce Simpson who completed the port; I still have to merge it in Gentoo though, damn lack of time.

Anwyway, one of the intersting things of the use of ZeroConf, as I said, is that you don’t have to check if the service was started by a box before launching the client, you just launch it and see if it’s available or not; I liked this quite a bit with KRFB and KRDC (VNC server and client for KDE, respectively) when using SLP, but that required openslp installed and the service running, which is quite annoying; KRFB actually already had advertisement over ZeroConf, but KRDC didn’t pick it up, and also KRFB is quite slow when compared with something newer like x11vnc.

So what did I do? In the little spare time I have in the last few days because of my job I decided to study a bit Avahi and see if I could make x11vnc advertise itself over ZeroConf. I succeeded, and Karl Runge (x11vnc author) accepted the patch (although he’s going to rework it a bit), and waiting for the next release, I’ve put the patched x11vnc on my overlay, as usual.

Now this solved half the problem, KRDC still didn’t pick it up, although Chicken of the VNC found it with Bonjour support just fine. So I looked at the code, KRDC 3.5.5 and 3.5.6 were supposed to actually support DNS-SD discovery of the VNC servers, but the code was placed in such a way that you had to actually enable that manually.. and if SLP support wasn’t enabled (or if the SLP daemon wasn’t running) there was no way that the code was started. Also, it was actually going to spawn and destroy the browser on every scan cycle, which was far from a good idea for what I could see of the design of kdnssd library, so it was better that hte code was almost unreachable.

Today I decided to get it fixed once forever, and with a pretty minimal patch, touching only two files, a source and an header file (to replace the empty destructor with one with a single instruction), I was able to finally discover the VNC servers on the lan, included the modified x11vnc. The patch for krdc is both committed upstream, and in portage with kde-base/krdc-3.5.6-r1 (not in kdenetwork).

Now, this was mostly an exercise for me to get my hands dirty with Avahi, as I think that ZeroConf is a pretty good idea: I loved when I bought the Airport Express to just plug it in, set up the name through the assistant (without need to even telling it where to look for it), and then see the printer available from the two laptops. CUPS instead didn’t discover it, and I had to set it up manually, but with my past experience with CUPS development, I’m not going to try patching this up myself 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.