uses
IdTCPClient;
function TForm1.checkinternet: Boolean;
var
tmpidclient: TIdTCPClient;
begin
Result := False;
try
try
tmpidclient := TIdTCPClient.Create(nil);
tmpidclient.ReadTimeout := 2000;
tmpidclient.ConnectTimeout := 2000;
tmpidclient.Port := 80;
tmpidclient.Host := 'www.baidu.com';
tmpidclient.Connect;
tmpidclient.Disconnect;
Result := true;
except
on e: Exception do
begin
Result := False;
end;
end;
finally
tmpidclient.DisposeOf;
tmpidclient := nil;
end;
end;
手机端判断是否连接internet网络
猜你喜欢
转载自blog.csdn.net/winniezhang/article/details/104166312
今日推荐
周排行