六行代码获取本地IP

uses IdIPWatch;

function GetNativeIP: String;
var
  IdIPWatch: TIdIPWatch;
begin
  IdIPWatch := TIdIPWatch.Create(nil);
  try
    Result := IdIPWatch.LocalIP;
  finally
    IdIPWatch.Free;
  end;
end;


DelphiXE7下编写。

你可能感兴趣的:(六行代码获取本地IP)