Jeremy,

Here's some code I use to retrieve IP address:

// returns ISP assigned IP
function 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;

Laurence Bevan

----- Original Message ----- 
From: Jeremy Coulter <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Monday, 21 June 1999 9:31 pm
Subject: [DUG]: Local Machines Dialup IP Address


> Hi all. How do I go about getting the IP Address of my current Dialup
> connection ?
> 
> I am using a socket component which hasa property GetLocalIPddress  which
> returns the IP address of my computer, not the dial in connection.
> 
> Can anyone help ??
> 
> Thanks, Jeremy Coulter
> 

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to