Performing a DNS Lookup
Posted on 2004-11-24
I am writing a mailer as part of a personal project for the purpose of sending out verification emails when a user creates an account on my server.
To do this, I need to retrieve the MX records for the destination hosts. I have spent ages reading through all the relevant RFCs but one simple piece of information eludes me: How the hel do you connect to a DNS server in the first place ??
I know it use port 53 but what IP address do you use? Is it assigned by the ISP and if so how do you find it?
My software is intended for windows and should work on all versions of it. I'm writing everything from scratch including the HTTP and SMTP services so I really need to know how to connect to the DNS instead of using some obscure function that I dont understand.