Re:Getting IP address
"Sakkie" <sak...@futfin.co.za> schrieb im Newsbeitrag news:9riue3$7bs$1@ctb-nnrp1.saix.net...
Quote
> Hi all,
> How do I get the IP address of the machine running my program? I need to
> verify username/password against IP address of people logging into our
> system. How do I obtain their IP addresses?
procedure GetIPAddress:string;
var wVersionRequested : WORD;
wsaData : TWSAData;
p : PHostEnt;
s : array[0..128] of char;
p2 : pchar;
begin
wVersionRequested := MAKEWORD(1, 1);
WSAStartup(wVersionRequested, wsaData);
GetHostName(@s, 128);
p := GetHostByName(@s);
p2 := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
Result:=Format('%s',[p2]);
WSACleanup;
end;