【文件属性】:
文件名称:DELPHI 实现ping功能
文件大小:510KB
文件格式:RAR
更新时间:2011-12-30 04:32:41
delphi ping
实现PING功能
With ICMP.ReplyStatus do
begin
Msg:='Reply from'+' '+edthost.Text;
Msg:=Msg+' '+'bytes='+IntToStr(BytesReceived); //返回字节数
Msg:=Msg+' '+'TTL='+IntToStr(TimeToLive); //返回生存时间
Tm:=MsRoundTripTime; //返回执行时间
if Tm<1 then Tm:=1;
Msg:=Msg+' '+'time='+IntToStr(Tm)+'ms';
lstlnfo.Items.Add(Msg);//保存信息
if (BytesReceived=0) or (TimeToLive=0) then
begin //无数据返回
b:=b+1; //记录掉包数量
lstlnfo.ItemIndex:=lstlnfo.Items.Count-1;
end;
//if lstlnfo.Count>100 then lstlnfo.Clear;
if i mod 100=0 then stat1.SimpleText:='Lost:'+IntToStr(b)+ '/'+IntToStr(i)+'='+copy(FloatToStr(b/i*1000),1,4)+'‰'; //每Ping到100次显示一次掉包情况
end;
【文件预览】:
ping
----Unit1.dfm(182KB)
----Project2.exe(721KB)
----Unit1.pas(2KB)
----Unit1.dcu(6KB)
----Project2.dof(3KB)
----Project2.res(876B)
----Unit1.~dfm(182KB)
----Unit1.~pas(2KB)
----Project2.cfg(434B)
----Project2.dpr(188B)