private void button1_Click(object sender, EventArgs e)
{
ServicePointManager.DefaultConnectionLimit = 1024;
MessageBox.Show(""+ ServicePointManager.DefaultConnectionLimit);
WebClient client = new WebClient();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback);
client.DownloadFileTaskAsync("https://lon-gb-ipv6.vultr.com/vultr.com.1000MB.bin", "d:\\gb.bin");
WebClient client2 = new WebClient();
client2.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback2);
client2.DownloadFileTaskAsync("https://par-fr-ipv6.vultr.com/vultr.com.1000MB.bin", "d:\\fr.bin");
WebClient client3 = new WebClient();
client3.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback3);
client3.DownloadFileTaskAsync("https://fra-de-ipv6.vultr.com/vultr.com.1000MB.bin", "d:\\de.bin");
}
private void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
}
private void DownloadProgressCallback2(object sender, DownloadProgressChangedEventArgs e)
{
progressBar2.Value = e.ProgressPercentage;
}
private void DownloadProgressCallback3(object sender, DownloadProgressChangedEventArgs e)
{
progressBar3.Value = e.ProgressPercentage;
}
为什么无法正常下载。。。。进度条飞快到达 100%
BTW 用 WebHttpRequest 还是用 WebClient 写下载器好?