Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Retrieving the mail server host name from the DNS !

Posted on 2002-04-27
2
Medium Priority
?
236 Views
Last Modified: 2010-04-02
SDK : C++ Builder 5

Hello,

I want to retrieve the ip address of a mail server from the DNS.

For example
When you have such address : larry@aol.com
I want to know the ip address of the mail server aol.com
and not the ip address of their Web site.

When i use the GetHostByName(), this function only returns me the ip address of the Web server.

Could you give a piece of code ...

Thank you
0
Comment
Question by:mars
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 450 total points
ID: 6973658
The socket function gethostbyname() only queries for "A" records.  To get a mail server you need to query for "MX" records.  There is no high-level socket function to do that.  You must do it yourself.

Here is an example of this:

http://www.codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=329921&Search=true&Forum=vc&Words=MX&Match=Whole&Topic=&Searchpage=0&Limit=25
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7036268
Please update and finalize this old, open question. Please:

1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.

EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.

Thanks,

** Mindphaser - Community Support Moderator **

P.S.  Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
0

Featured Post

Technology Partners: 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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

926 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