码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi Ping

时间:2020-05-10 12:31:05      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:pcl   receive   try   time   integer   exce   res   func   cli   

function PingServer(HostIP: string;LinkTimeOut: integer): boolean;
var
  RRemoteC: TIdIcmpClient;
  AReplyStatus: TReplyStatus;
begin
  try
    result := true;
    RRemoteC := TIdIcmpClient.Create(nil);
    RRemoteC.Host := HostIP;
    RRemoteC.ReceiveTimeout := LinkTimeOut;
    try
      RRemoteC.Ping;
      AReplyStatus := RRemoteC.ReplyStatus;
      if (AReplyStatus.ReplyStatusType = rsTimeOut) then
      begin
        result := false;
      end;
    except
      result := false;
    end;
  finally
    RRemoteC.Free;
  end;
end;

  

Delphi Ping

标签:pcl   receive   try   time   integer   exce   res   func   cli   

原文地址:https://www.cnblogs.com/CipherLab/p/12862720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!