Question

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++. 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, but I need to do it in C++.

Many thanks in advance

Was it helpful?

Solution

There is an Open Source library (released under the LGPL) available over at http://avahi.org/. It exposes a C interface that can be very easily used in a c++ program.

There are also prebuilt binary version available for all major distros.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top