0

I want to use the C avahi library to create a dialog box in gtk that can list all the services in DNS-SD network. I am able to list all the services in a dialog box but I want to clean this list of duplicate entries. output for avahi-browseAs you can see in the image above that that output of avahi-browse -a in my terminal gives me a lot of duplicates of the same service but from different interfaces( and hence different addresses ). I want to remove these duplicates.

Therefore to achieve this I used a hash-table to store the previously found services and only add a new service if the string concatenation of name, port, type, domain, host_name has never been added before. The code for which is roughly as shown below. enter image description here

Note- I did not include the parameter address and that is what I am curious about.

The end goal for me is to remove duplicates from different interfaces and protocols as on resolving we can see that these duplicates services have different addresses. enter image description here

Will I be excluding unique services if I don't consider the address parameter?

Divyasheel
  • 15
  • 4
  • Please do not post code and text logs as images - [reasoning](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question). Copy it as formatted text into the question. – kaylum Aug 19 '21 at 05:32
  • @kaylum Okay, I won't, just bare with me this time as I don't have the same setup up right now. – Divyasheel Aug 19 '21 at 05:54

0 Answers0