如何在DELPHI中实现PING固定IP,回答的好给加100分

[复制链接]
查看11 | 回复0 | 2009-6-22 15:51:49 | 显示全部楼层 |阅读模式
uses IdRawBase, IdRawClient, IdIcmpClient;{**********************************************函数说明:Ping服务器IP函数***********************************************}function TMainForm.m_func_PingServer(HostIP: string; LinkTimeOut: integer): boolean;varRRemoteC: TIdIcmpClient;AReplyStatus: TReplyStatus;beginresult := True;exit;try
result := true;
RRemoteC := TIdIcmpClient.Create(self);
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;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行