function LocalIPList(Name:String) : TStrings;
var
phe : PHostEnt;
begin
IPList.Clear;
Result := IPList; phe := WSocketGetHostByName(Name);
if phe <> nil then
GetIpList(Phe, IPList);
end;
procedure GetIPList(phe : PHostEnt; ToList : TStrings);
type
TaPInAddr = array [0..255] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
pptr : PaPInAddr;
I : Integer;
begin
pptr := PaPInAddr(Phe^.h_addr_list); I := 0;
while pptr^[I] <> nil do begin
ToList.Add(StrPas(WSocket_inet_ntoa(pptr^[I]^)));
Inc(I);
end;
end;
var
phe : PHostEnt;
begin
IPList.Clear;
Result := IPList; phe := WSocketGetHostByName(Name);
if phe <> nil then
GetIpList(Phe, IPList);
end;
procedure GetIPList(phe : PHostEnt; ToList : TStrings);
type
TaPInAddr = array [0..255] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
pptr : PaPInAddr;
I : Integer;
begin
pptr := PaPInAddr(Phe^.h_addr_list); I := 0;
while pptr^[I] <> nil do begin
ToList.Add(StrPas(WSocket_inet_ntoa(pptr^[I]^)));
Inc(I);
end;
end;
请问要用到那些单元?