?
Solved

Performing a DNS Lookup

Posted on 2004-11-24
3
Medium Priority
?
216 Views
Last Modified: 2012-05-05
Greetings,

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.
0
Comment
Question by:LordWolfy
3 Comments
 
LVL 3

Accepted Solution

by:
vippx earned 750 total points
ID: 12672925
Hi,

The DNS address is often ISP specific and assinged by the ISP as a network property. So can be found out by checking the address in  the TCP/IP properties. Often this may be something that is autoconfigured so this information is fetched from the DHCP server. The best option, leave the IP of the DNS as a configurable item which the clients can enter after consulting their ISP

Aftewr that, u can open a TCP or UDP socket at the configured IP and port 53 and connect to the DNS server. On connection, just send the message, formatted with appropriate fields, as mentioned in the RFC 1035. And to this the server would respond in the required format sending u lla the information you need.

You need look up information on what data u need to send down the socket and what kind of response would u recieve. the creating and parsing of sent and recieved messages is then a programmable task.

this would help u find more information on implementing the protocol.

http://www.freesoft.org/CIE/Topics/77.htm

0
 
LVL 19

Assisted Solution

by:RanjeetRain
RanjeetRain earned 750 total points
ID: 12674181
0
 
LVL 2

Author Comment

by:LordWolfy
ID: 12678188

Found what I was looking for : The function GetNetworkParams in IPHLPAPI.DLL

I'll split the points between you because the answers are still informative.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question