여기 저기 한참 찾아보니 있었네요.^^
function GetLocalIP: string;
var
wsaData: TWSAData;
slocal: string;
hos: PHostEnt;
addr: PChar;
begin
result := '';
if WSAStartup($101, wsaData) <> 0 then exit;
SetLength(slocal, 256);
if gethostname(PChar(slocal), 256) = SOCKET_ERROR then exit;
hos := gethostbyname(PChar(slocal));
if hos = nil then exit;
addr := (hos.h_addr_list)^;
result := IntToStr(Byte(addr[0])) + '.' + IntToStr(Byte(addr[1])) + '.'
+ IntToStr(Byte(addr[2])) + '.' + IntToStr(Byte(addr[3]));
WSACleanup;
end;
|