 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Patrick Guest
|
Posted: Mon Nov 24, 2003 8:00 pm Post subject: Re: IP Address |
|
|
maybe this will help you...
Function GetLocalIP(): 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;
--
Patrick Paquette
Programmeur analyste
"Kiss Miklós" <kissmiklos (AT) freemail (DOT) hu> a écrit dans le message de
news:3fc08543$1 (AT) newsgroups (DOT) borland.com...
| Quote: | How can I determine the IP address of the local computer? And how can I
convert host name to IP address and back?
Thanks!
MikKi
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|