M
mynone
Unregistered / Unconfirmed
GUEST, unregistred user!
用idicmpclientl來寫一個ping程序,要是多開幾個窗口來ping多個地址,系統就提示內存不足了???
我用idicmpclientl來每隔50ms就ping一次
1,(是否可以不用定時器,讓它做完就就delay 50ms不知會不會有幫助.)
2,是否有其它更好的ping方法
procedure TForm1.Timer1Timer(Sender: TObject);
var
idIcmp:TIdIcmpClient;
begin
try
idIcmp := TIdIcmpClient.Create(nil);
idIcmp.ReceiveTimeout := strtoint(edit1.text);
idIcmp.Host :=edit2.Text;
idicmp.BufferSize:=8192;
idIcmp.Ping;
if idIcmp.ReplyStatus.ReplyStatusType=rsEcho then
begin
if ProgressBar1.Position>=100 then
ProgressBar1.Position:=0;
ProgressBar1.Position:=ProgressBar1.Position+10;
exit;
end;
finally
idicmp.Destroy;
end;
windows.Beep(1047,500);
end;
我用idicmpclientl來每隔50ms就ping一次
1,(是否可以不用定時器,讓它做完就就delay 50ms不知會不會有幫助.)
2,是否有其它更好的ping方法
procedure TForm1.Timer1Timer(Sender: TObject);
var
idIcmp:TIdIcmpClient;
begin
try
idIcmp := TIdIcmpClient.Create(nil);
idIcmp.ReceiveTimeout := strtoint(edit1.text);
idIcmp.Host :=edit2.Text;
idicmp.BufferSize:=8192;
idIcmp.Ping;
if idIcmp.ReplyStatus.ReplyStatusType=rsEcho then
begin
if ProgressBar1.Position>=100 then
ProgressBar1.Position:=0;
ProgressBar1.Position:=ProgressBar1.Position+10;
exit;
end;
finally
idicmp.Destroy;
end;
windows.Beep(1047,500);
end;