?
Solved

How to execute a reverse DNS lookup

Posted on 2003-03-03
5
Medium Priority
?
1,569 Views
Last Modified: 2013-11-13
Greets all.


First, let me say that I am not a Visual Basic writer. I have not used the langage for years, so the exact details of the syntax escape me.


Anyway, I am looking to execute a reverse DNS lookup(getting a hostname from an IP adress). I have a written a procedure to execute this in Delphi using the gethostbyaddr Windows Socket function, but havent figured out how to port it to VB.

If someone could furnish an exemple of ported code(or a different code that functions), with included the needed declarations to get Winsock started in VB, would be great.


Thanks in advance!


//Procedure in Delphi
procedure TDNSLookupThread.GetHostName;
var
  wsdata : TWSAData;
  he : PHostEnt;
  lip : TInAddr;
begin
  WSAStartup(MakeWord(1, 1), wsdata);
  lip.S_addr := inet_addr(PChar(IP));
  he := gethostbyaddr(@lip.S_un_b, 4, AF_INET);
  if he<>nil then
    Host := string(he.h_name)
  else
    Host := '';
  WSACleanup();
end;
0
Comment
Question by:Aderei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 320 total points
ID: 8057663
"How to Obtain the Host Name from an IP Address"
http://www.mvps.org/vbnet/index.html?code/network/hostnamefromip.htm
0
 

Expert Comment

by:CleanupPing
ID: 8900837
Aderei:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 8902191
Recommendation: Points to AzraSound
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9023977
Moderator, my recommended disposition is:

    Accept AzraSound's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

801 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