【发布时间】:2011-03-17 08:36:50
【问题描述】:
我尝试在使用 WebClient 时捕获连接问题。例如,无法访问,超时等。下面的代码不起作用,好像没有错。
WebClient wc = new WebClient();
try
{
wc.UploadFileAsync(new Uri(@"ftp://tabletijam/FileServer/upload.bin"), Directory.GetCurrentDirectory() + @"\crypto.bin");
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
【问题讨论】:
-
嗯......提供的代码sn-p应该有什么问题吗?
-
代码没有错。我做了什么,但我仍然不知道上传是否开始。我想要实现的是,我如何知道客户端主机是否无法访问,或者传输是否有问题?
标签: c# .net debugging webclient