mjansson / mdns

Public domain mDNS/DNS-SD library in C
The Unlicense
459 stars 120 forks source link

DNS #41

Closed pkalphaChen closed 3 years ago

pkalphaChen commented 3 years ago

Hello,first of all thanks for this great library! I have a question. How to access by domain name? Can you give me an example? thank you.

pkalphaChen commented 3 years ago

And no broadcast packets were issued when DNS-SD was running.

mjansson commented 3 years ago

This library is intended for multicast dns, in the .local domain.

The mdns.c example program shows how to setup a socket on port 5353 and listen to dns-sd, and how to send an answer for your service.

pkalphaChen commented 3 years ago

I modified the .c example a little bit and wanted to integrate the code into the embedded device. Start the Fedora system in the virtual machine, use avahi-browse -a to search for the embedded device, and cannot access it through "hostname.local". I have been trying for many days, but I can’t succeed, because it is the first time to do it, so I need a little guidance. I kindly ask you to give a simple modified example, thank you very much!

pkalphaChen commented 3 years ago

Now you can access the device via "domain name. Local" in Fedora. You can use avahi-browse-r to parse out the device information, and the information is correct, but you can't scan the device using avahi-browse-a.

mjansson commented 3 years ago

The library did not handle questions for "ANY" records, and also handled DNS-SD queries with multiple questions in the wrong way.

This has been fixed, try the latest master branch.

pkalphaChen commented 3 years ago

Thank you very, very much! Problem solved!