Solved

IP of server?

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

Thanks a lot.
0
Comment
Question by:neox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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