Try
Uses Winsock;
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;
Dave
-----Original Message-----
From: Joel van Velden [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 1 November 2000 14:51
To: Multiple recipients of list delphi
Subject: [DUG]: How to get ip address?
I'm sure it's somewhere in the windows sdk help files, but i can't find it,
so what the heck:
How do i go about programmatically getting the current IP address that's
being used for the internet?
Also: What's the easiest and smallest way to be able to send data across the
internet using a client/server system, but without using a component?
TIA
-Joel
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"