How might I perform DNS lookups using C/C++ on Linux?

Answer

If a blocking (synchronous) query is ok, just use res_query(), and link your program with -lresolv.

 len = res_query(host, C_IN, T_MX, &answer, sizeof(answer));

All dns Questions

Ask your interview questions on dns

Write Your comment or Questions if you want the answers on dns from dns Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---