Solved

IP of server?

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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