Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to execute a reverse DNS lookup

Posted on 2003-03-03
5
Medium Priority
?
1,573 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
  • 2
4 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

578 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