对于webClient.DownloadFile设置超时() [英] Set timeout for webClient.DownloadFile()
本文介绍了对于webClient.DownloadFile设置超时()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用 webClient.DownloadFile()
下载我可以设置超时这样的文件,以便它不会需要很长时间,如果它不能访问文件?
I'm using webClient.DownloadFile()
to download a file can I set a timeout for this so that it won't take so long if it can't access the file?
推荐答案
尝试 WebClient.DownloadFileAsync()
。您可以拨打 CancelAsync()
在定时器用自己的超时。
Try WebClient.DownloadFileAsync()
. You can call CancelAsync()
by timer with your own timeout.
这篇关于对于webClient.DownloadFile设置超时()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文