I would like to know the way to collect the IP of my PC and resolve and display

I would like delphi to grab my ISP IP and show and next to this resolve it to the hostname.
Could someone write a basic command to do this to add a nice feature to my program.

If you check this example URL you will see what I wish to display.

http://www.ipaddresslocation.org/

I am interested in showing what they call..

1.My IP Address (Public, External or WAN IP Address)
2.My IP Location (Guessed City)
3.Proxy Server Detection

I wish to be able to click "show details" and then show as above with no user interface.
Inter2001Asked:
Who is Participating?
 
TheRealLokiSenior DeveloperCommented:
You could just screen scrape the HTML you get back from
http://www.tellmemyip.biz/
or whatismyip   lots of others
There's no other easy way to tget your "EXTERNAL" ip address, so you may as well use it and grab the hostname from it too....
no point doing the RDNS/whois etc yourself
0
 
senadCommented:
Try :
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,WinSock, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
   Timer1: TTimer;
   Label1: TLabel;
   function LocalIP: string; //<--insert this line
    procedure FormCreate(Sender: TObject);
   procedure Timer1Timer(Sender: TObject);
    procedure FormResize(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
function TForm1.LocalIP: string;
type
  TaPInAddr = array [0..10] of PInAddr;
  PaPInAddr = ^TaPInAddr;
var
   phe: PHostEnt;
   pptr: PaPInAddr;
   Buffer: array [0..63] of char;
   i: Integer;
   GInitData: TWSADATA;
begin
   WSAStartup($101, GInitData);
   Result := '';
   GetHostName(Buffer, SizeOf(Buffer));
   phe :=GetHostByName(buffer);
   if phe = nil then Exit;
   pptr := PaPInAddr(Phe^.h_addr_list);
   i := 0;
   while pptr^[i] <> nil do
   begin
     result:=StrPas(inet_ntoa(pptr^[i]^));
     Inc(i);
   end;
   WSACleanup;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
  Label1.Caption:=LocalIP;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Label1.Caption:=LocalIP;
end;

procedure TForm1.FormResize(Sender: TObject);
begin
Application.Title := Label1.Caption;

end;

end.

Open in new window

0
 
Geert GOracle dbaCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.