var
phoste: PHostEnt;
Buffer: array[0..100] of char;
WSAData: TWSADATA;
begin
Result := '';
if WSASTartup($0101, WSAData) <> 0 then exit;
GetHostName(Buffer,Sizeof(Buffer));
phoste := GetHostByName(buffer);
if phoste = nil then
begin
Result := '127.0.0.1';
end
else
Result := StrPas(inet_ntoa(PInAddr(phoste^.h_addr_list^)^));
WSACleanup;
end;