请教IdIcmpClient控件的用法 请教IdIcmpClient控件的用法 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit ping;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, IdBaseComponent, IdComponent, IdRawBase, IdRawClient, IdIcmpClient;type TPingFrm = class(TForm) ICMP: TIdIcmpClient; Panel1: TPanel; Button1: TButton; Button2: TButton; Edit1: TEdit; Label1: TLabel; ListBox1: TListBox; procedure Button2Click(Sender: TObject); procedure ICMPReply(ASender: TComponent; const AReplyStatus: TReplyStatus); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var PingFrm: TPingFrm;implementation{$R *.dfm}procedure TPingFrm.Button2Click(Sender: TObject);beginListBox1.Clear ;end;procedure TPingFrm.ICMPReply(ASender: TComponent; const AReplyStatus: TReplyStatus);varsTime: string;beginif AReplyStatus.ReplyStatusType=rsError then showmessage('hello*');if (AReplyStatus.MsRoundTripTime = 0 ) thensTime := '<1'elsesTime := '=';ListBox1.Items.Add(Format('ICMP_SEQ=%d Reply from %s [%s] : Bytes=%d time%s%d ms TTL=%d',[AReplyStatus.SequenceId,Edit1.Text,AReplyStatus.FromIpAddress,AReplyStatus.BytesReceived,sTime,AReplyStatus.MsRoundTripTime,AReplyStatus.TimeToLive]));end;procedure TPingFrm.Button1Click(Sender: TObject);vari : integer;beginICMP.Host := Edit1.Text ;ICMP.ReceiveTimeout := 1000;Button1.Enabled := false;tryfor i:=0 to 3 dobeginICMP.Ping ;Application.ProcessMessages ;end;finallyButton1.Enabled := true;end;end;end. 请教WORD转换成RTF fastreport 4.0 232口可以实现1:n广播式通讯吗 数据库连接时间问题 中国P2P联盟招人啦 使用AT中的PDU模式收发中英文短信问题!!! 关于类封装的问题 怎样得到汉字的声母? 如何知道正在运行的exe文件的字节数? 安装??? Word 打开Rave存当的RTF文件是乱码?!!! 如何浏览对方的文件?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, IdBaseComponent, IdComponent, IdRawBase,
IdRawClient, IdIcmpClient;type
TPingFrm = class(TForm)
ICMP: TIdIcmpClient;
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
ListBox1: TListBox; procedure Button2Click(Sender: TObject);
procedure ICMPReply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
PingFrm: TPingFrm;implementation{$R *.dfm}
procedure TPingFrm.Button2Click(Sender: TObject);
begin
ListBox1.Clear ;
end;procedure TPingFrm.ICMPReply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
var
sTime: string;
begin
if AReplyStatus.ReplyStatusType=rsError then showmessage('hello*');
if (AReplyStatus.MsRoundTripTime = 0 ) then
sTime := '<1'
else
sTime := '=';
ListBox1.Items.Add(Format('ICMP_SEQ=%d Reply from %s [%s] : Bytes=%d time%s%d ms TTL=%d',
[AReplyStatus.SequenceId,
Edit1.Text,
AReplyStatus.FromIpAddress,
AReplyStatus.BytesReceived,
sTime,
AReplyStatus.MsRoundTripTime,
AReplyStatus.TimeToLive]));
end;procedure TPingFrm.Button1Click(Sender: TObject);
var
i : integer;
begin
ICMP.Host := Edit1.Text ;
ICMP.ReceiveTimeout := 1000;
Button1.Enabled := false;
try
for i:=0 to 3 do
begin
ICMP.Ping ;
Application.ProcessMessages ;
end;
finally
Button1.Enabled := true;
end;
end;
end.