My application is used to download files. After the files are downloaded, the size of those files is compared to elements in an XML file for validation. The XML file has an element for each file with a "size" attribute. This is the size that the downloaded file is supposed to be. The files validate fine on a normal Ethernet connection. When a slow wireless connection is used, files are constantly failing validation, meaning the downloaded files are not the size they're supposed to be. Why is it that the WebClient DownloadFileAsync() method cannot successfully download a file on a slow or unstable network? Is there any way around this besides retrying over and over?
foreach (var file in fileList.OrderBy(x => x.Name))
{
var client = new WebClient();
client.DownloadFileCompleted += (o, a) => Task.Factory.StartNew(() => OnDownloadFileCompleted());
client.DownloadFileAsync(new Uri(AppStrings.FileServer + file.Name), AppStrings.FilePath + file.Name);
webClientList.Add(client); //used to dispose later, after all files complete.
}