Getting MX Records in a C program
I need to find out the mx records bound to a domain for an SMTP server. The thing is, I can't use any library except the system ones (Linux and Windows).
There's very little documentation around the web around that...
Right now, I have the domain name with which I need to talk, as a string. And what I need is the MX Record from this name, just as I would get them using the "nslookup -type=mx domain.com" command. Except that I need to get those records by myself, and in a way that wil开发者_JS百科l work running either Linux or Windows.
On Linux systems you should have libresolv
available as part of glibc
.
Take a look at the man page for the res_query
function.
精彩评论