LINUX C language programming gains MX record
/ ************************************************** ******************
* This article is first in BBS.BLUEGEM.ORG Linux District
* I email: chenfei@sohu.com
* If you reprinate this article, please keep the starting ground and your contact method for easy communication, thank you!
*********************************************************** **************** /
One. demand analysis:
Programming with C language in Linux implements a MX record of a domain.
two. Programming
turn off
Key function:
RES_SEARCH, please refer to Man Page.
three. Realization:
http://user.pa.net/~hallerp/thesis/msmtpd-1.0.0/src/dns.c
This code is also an implementation of a project, a single function. Returning all MX records in response order in a string, in ":" segmentation. There is no better source readability of Postfix, Sendmail and Nslookup.
four. Reference:
Linux Man Page.
"Linux DNS Server Administration Guide" Electronic Industry Press.
Postfix source.
Nslookup command source code. The nslookup command belongs to Bind-Utils-9.1.3-4.
Sendmail source code.
http://user.pa.net/~hallerp/thesis/msmtpd-1.0.0/src/dns.c