1,183
社区成员
发帖
与我相关
我的任务
分享
加上:edit,button,listbox,idicmpclient四个控件
双击button
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
idicmpclient.Host:=edit1.Text;
for i:=0 to 3 do
begin
idicmpclient.Ping;
application.ProcessMessages;
sleep(1000);
end;
end;
在idicmpclient事件的onreply中加代码
procedure TForm1.idicmpclientReply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
var
stime:string;
begin
stime:='=';
listbox1.Items.Add(format('Reply from %s: time=%dms TTL=%d ms',
[aReplyStatus.fromipaddress,\\ping的IP地址
aReplyStatus.sequenceid div 100,\\整除100是为了显示MS(毫秒)
aReplyStatus.timetolive,\\生命周期
stime,
aReplyStatus.msroundtriptime]));\\不知道是什么
end;