[avahi] How could I create an AVAHI client & server using C++?

Jorge Arevalo jorgeas80 at gmail.com
Fri Apr 11 00:45:44 PDT 2014


Hello,

I'm coding a C++ library that, among other things, needs to:

- Search for a specific service in a network using AVAHI
- Publish itself as a service using AVAHI

I've been searching for existent options. I've found that the creators of 
POCO C++ offer a DNS-SD library integrated with POCO C++ [1]. That would 
work, because I'm actually using POCO C++, but it's a commercial library, 
and I can't afford it.

Apart from that, avahi-daemon offers a client interface that allows browsing 
services and publishing new ones. It also sounds good, but I need my code to 
be portable, and work in major Linux distributions, Mac OS X and Windows. 
AFAIK, this solution would only cover Linux (where avahi-daemon is 
available).

I guess as partial solution, I could just send a properly formatted message 
via socket and process the raw response. That way, I could search for 
services published using AVAHI. But I think that's ugly and unmaintainable.

So, is there any good-enough solution for this without buying a software? I 
know this can be done using Python [2], but I need to do it in C++.

Many thanks in advance

[1] http://www.appinf.com/docs/poco/00200-DNSSDTutorialAndUserGuide.html
[2] http://stackoverflow.com/questions/3430245/how-to-develop-an-avahi-
client-server




More information about the avahi mailing list