Suroot
Suroot

Reputation: 4423

Querying full DNS record

I do alot of programming in *nix using C gcc. I know how to do a basic gethostbyname(). BUt what if I wanted to pull down the entire DNS record. More to the point, is there a function that I'm missing that allows you to specify the specific record that you want to pull? Or will I need to do this manually through a UDP socket?

Upvotes: 2

Views: 2549

Answers (2)

bortzmeyer
bortzmeyer

Reputation: 35459

See also Code to do a direct DNS lookup.

Upvotes: 1

jpalecek
jpalecek

Reputation: 47762

No, there is no such function in standard C or POSIX (and even the gethostbyname function, contrary to what you may think, is not a function for querying DNS - it can use any other way to get the address, like /etc/hosts or mDNS, whatever).

You might want to look at some DNS-specific libraries, like ldns, libbind or libdjbdns.

Upvotes: 3

Related Questions