Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IP of server?

Posted on 2000-04-01
5
Medium Priority
?
165 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 40 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 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