用delphi如何实现‘ping cn4.grunt.wowchina.com’ ( 积分: 30 )

  • 主题发起人 主题发起人 mazheng
  • 开始时间 开始时间
M

mazheng

Unregistered / Unconfirmed
GUEST, unregistred user!
用delphi如何实现‘ping cn4.grunt.wowchina.com’
 
用API: winexec
 
我的意思是:如何知道 ‘cn4.grunt.wowchina.com’通与不通??
 
用INDY的ICMPCLIENT控件

procedure TForm1.Button1Click(Sender: TObject);
begin
IdIcmpClient1.Ping('192.168.0.1');
end;

procedure TForm1.IdIcmpClient1Reply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
begin
Memo1.Lines.Add(Format('Reply from %s: bytes=%d time %d ms TTL=%d',
['192.168.0.1', AReplyStatus.BytesReceived, AReplyStatus.MsRoundTripTime, AReplyStatus.TimeToLive]));
end;
 
后退
顶部