Solved

Retrieving the mail server host name from the DNS !

Posted on 2002-04-27
2
189 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 150 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
why "." vs "->" 23 115
Lambda for random numbers problem 7 100
how to convert c++ code to Android App 3 64
Socket Programming (Unix) 8 98
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now