Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using DNSServiceGetAddrInfo to resolve IP address from hostname (with interface specification) #99

Open
benkuper opened this issue Oct 16, 2020 · 1 comment

Comments

@benkuper
Copy link

Hello,
I've been using getaddrinfo() to resolve IP from hostname, but the problem is that getaddrinfo() doesn't allow for specifying a network interface, and multiple devices with same hostname on different interfaces will not work with this method.
I couldn't find a generic method to work around this problem, except implementing the Bonjour / Avahi API.
DNSServiceGetAddrInfo allows to do that and it would make the library very powerful and complete to have that inside, especially since Bonjour and Avahi already have those methods ready to use.

I have tried myself but the callback of DNSServiceGetAddrInfo was never triggered, I'm not sure why but if someone has more insight on this this would be great !a

@benkuper
Copy link
Author

Just for info, I forked and added the piece of code to include servus_port and servus_ip in the data. This is only in the dns-sd implementation, and JM Celerier has made the same for the avahi implementation.
Mine is quite dirty so I'm not making a PR for that but there is everything needed to do some proper, complete system for full-info retrieval which would make this library waaaay more useful than only getting the hostname.

benkuper@fbe6ab4#diff-b1586d4d2cda7428bff40ee9f7b7493b6079b60de0fba03e0ea3349aff3e3bf5

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant