V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
hard2reg
V2EX  ›  问与答

C#写下载器的问题

  •  
  •   hard2reg · 2017-11-28 13:38:25 +08:00 · 1345 次点击
    这是一个创建于 2355 天前的主题,其中的信息可能已经有所发展或是发生改变。
            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 写下载器好?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3123 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:34 · PVG 08:34 · LAX 17:34 · JFK 20:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.