Hi am a newbie.. I just want to write DNS client program using C sockets that takes three arguments: a query name (e.g., host name or domain name) and a query type (A, or NS, or MX), and DNS server name. Print out the responses in the answer section of the DNS record received.
I know there is a command getaddrinfo
..
but I just want to connect to lookup table and then
get the DNS server name...
so when i give the input ./a.out www.google.com A 144.20.190.70
it will show something similar to this:
Server: 144.20.190.70 Address: 144.20.190.70#53
Non-authoritative answer:
Name : www.google.com
Canonical name : www.l.google.com
Name : www.l.google.com Address : 74.125.19.104
Name : www.l.google.com Address : 74.125.19.105
Name : www.l.google.com Address : 74.125.19.106
Name : www.l.google.com Address : 74.125.19.147
Name : www.l.google.com Address : 74.125.19.99
Name : www.l.google.com Address : 74.125.19.103