Solved

IP of server?

Posted on 2000-04-01
5
158 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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