Delphi:超时时停止 idHTTP 工作
我这样做 idHTTP.Get('http://example.com/1.zip', FStream);
服务器没有响应...并且 idHTTP 等待连接来下载文件
我需要停止 idHTTP 工作。如果已连接,我可以执行idHTTP1.Disconnect
。
但是当 idHTTP 未连接、超时且 idHTTP 等待连接时该怎么办 ->我们一直在等待,等待,然后会引发超时异常(我需要在这段等待时间内停止工作)。所以我无法执行idHTTP1.Disconnect
。如果这样做,则会引发未连接
异常,因为我们没有连接。
如何在等待连接时停止工作而不出现异常?
谢谢!
I do idHTTP.Get('http://example.com/1.zip', FStream);
A server doesn't response...and idHTTP waits for a connect to download a file
I need to stop idHTTP working. If it's connected I can do idHTTP1.Disconnect
.
But what about a time when idHTTP isn't connected, when a time out is, and idHTTP waits for a connect -> we are waiting, waiting and then a time out exception will raise (I need to stop working in this waiting time). So I cannot do idHTTP1.Disconnect
. If to do that then a not connected
exception will raise, because of we are not connected.
How to stop working while waiting for a connect without an exception?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
TidHTTP 组件连接操作的最长时间可以通过
ConnectTimeout
属性来限制。The maximum time for the connect operation of a TidHTTP component can be limited with the
ConnectTimeout
property.