谢谢!
解决方法 最好的检查是尝试实际下载文件.“互联网”几乎不是你可以连接的真实东西.如果你连接到“互联网”,那么很难测试.您实际上不需要连接到“Internet”,您需要连接到您的服务器.所以测试一下.
也可以看看
> How to check if internet connection is present in java?
> What is the best way to check for Internet connectivity using .NET?
Inno Setup中的等效实现如下:
function InitializeSetup(): Boolean;var WinhttpReq: Variant; Connected: Boolean;begin Connected := False; repeat Log('Checking connection to the server'); try WinhttpReq := CreateoleObject('Winhttp.WinhttpRequest.5.1'); { Use your real server host name } WinhttpReq.Open('GET','https://www.example.com/',False); WinhttpReq.Send(''); Log('Connected to the server; status: ' + IntToStr(WinhttpReq.Status) + ' ' + WinhttpReq.StatusText); Connected := True; except Log('Error connecting to the server: ' + GetExceptionMessage); if WizardSilent then begin Log('Connection to the server is not available,aborting silent installation'); Result := False; Exit; end else if MsgBox('Cannot reach server. Please check your Internet connection.',mbError,MB_RETRYCANCEL) = IDRETRY then begin Log('retrying'); end else begin Log('Aborting'); Result := False; Exit; end; end; until Connected; Result := True;end;总结
以上是内存溢出为你收集整理的inno-setup – 如何使用Inno Setup检查Internet连接全部内容,希望文章能够帮你解决inno-setup – 如何使用Inno Setup检查Internet连接所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)