Solved

IP of server?

Posted on 2000-04-01
5
157 Views
Last Modified: 2012-05-04
How to find out an IP of any server?

Thanks a lot.
0
Comment
Question by:neox
  • 2
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 10 total points
ID: 2676314
HI
add winsock to the uses section.

uses Winsock;

function GetIPAddress(name : string) : string;
var wsdata : TWSAData;
    he : PHostEnt;
    ss : pchar;
    ip : TInAddr;
begin
  WSAStartup(MakeWord(1, 1), wsdata);
  he := gethostbyname(pchar(name));
  if he<>nil then
  begin
    ip.S_addr := integer(pointer(he^. h_addr_list^)^);
    ss := inet_ntoa(ip);
    Result := string(ss);
  end;
  WSACleanup();
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
form1.caption := GetIPAddress('www.microsoft.com');
end;
0
 

Author Comment

by:neox
ID: 2677695
the points are yours, but could you tell me it 'vice versa' (From IP address find out name)?

thanks.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2678021
sorry i dont know that one.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2683762
listenning
i think you can use the DNS component from FPIette's package to do the viceversa (ip to hostname)
http://www.rtfm.be/fpiette/indexuk.htm
0
 

Author Comment

by:neox
ID: 2696091
I haven't found any component which can do this there:-(
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

929 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

10 Experts available now in Live!

Get 1:1 Help Now