procedure TForm1.pingClick(Sender: TObject);
var
i: Integer;
begin
form1.ping.Enabled:=false;
IdIcmp.ReceiveTimeout:=200;
for i := 0 to Listbox1.Count - 1 do
begin
Application.ProcessMessages;
sleep(100);
IdIcmp.Host:=Listbox1.Items[i];
Listbox1.ItemIndex:=i;
IdIcmp.Ping;
idicmp.Free;
form1.ping.Enabled:=true;
//if stop then Break;end;
end;
procedure TForm1.IdIcmpReply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
begin
case AReplyStatus.ReplyStatusType of
rsEcho: Listbox2.Items.Add(IdIcmp.Host+' 成功 耗时(毫秒):'+inttostr(areplystatus.MsRoundTripTime));
rsError: Listbox2.Items.Add(IdIcmp.Host+' 错误 ');
rsTimeOut:Listbox2.Items.Add(IdIcmp.Host+' 超时 ');
rsErrorUnreachable:Listbox2.Items.Add(IdIcmp.Host+' 地址错误 ');
else
Listbox2.Items.Add(IdIcmp.Host+' 其他未知错误 ');
end;
Listbox2.ItemIndex:=Listbox2.Count-1;
end;出错提示
Listbox1.Items[i]里面有200多个IP地址
报错如何处理呢
var
i: Integer;
begin
form1.ping.Enabled:=false;
IdIcmp.ReceiveTimeout:=200;
for i := 0 to Listbox1.Count - 1 do
begin
Application.ProcessMessages;
sleep(100);
IdIcmp.Host:=Listbox1.Items[i];
Listbox1.ItemIndex:=i;
IdIcmp.Ping;
idicmp.Free;
form1.ping.Enabled:=true;
//if stop then Break;end;
end;
procedure TForm1.IdIcmpReply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
begin
case AReplyStatus.ReplyStatusType of
rsEcho: Listbox2.Items.Add(IdIcmp.Host+' 成功 耗时(毫秒):'+inttostr(areplystatus.MsRoundTripTime));
rsError: Listbox2.Items.Add(IdIcmp.Host+' 错误 ');
rsTimeOut:Listbox2.Items.Add(IdIcmp.Host+' 超时 ');
rsErrorUnreachable:Listbox2.Items.Add(IdIcmp.Host+' 地址错误 ');
else
Listbox2.Items.Add(IdIcmp.Host+' 其他未知错误 ');
end;
Listbox2.ItemIndex:=Listbox2.Count-1;
end;出错提示
Listbox1.Items[i]里面有200多个IP地址
报错如何处理呢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货