使用WebClient提高FTP服务器的文件下载速度 [英] Increse download speed of file from FTP Server using WebClient

查看:435
本文介绍了使用WebClient提高FTP服务器的文件下载速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用WebClint类从FTP服务器位置下载文件。

我的文件大小有时甚至更多。

目前需要2小时才能下载单个文件。但是它在filezilla中更少。

如何使用webclient提高文件的下载速度?或者是否有任何替代方法以更快的速度下载文件?



截至目前我已经逐个下载文件。有没有办法开始下载所有文件一次?

Hi,
Iam using WebClint class to download a file from FTP Server location.
My file size is 2GB sometimes even more.
Currently it is taking 2hours to download single file.But it is less in filezilla.
How to increase the download speed of file using webclient? Or Is there any alternative approach to download the file with increased speed?

As of now Iam downloading one by one file.Is there any way to start downloading all files at once?

推荐答案

如果你可以考虑 HttpWebRequest 而不是 WebClient ,然后你可以使用 HttpWebRequest.AddRange Method(Int32,Int32) [ ^ ]。



参考 - 如何提高网站上文件的下载速度? [ ^ ]

if you could consider HttpWebRequest instead of WebClient, then you can use HttpWebRequest.AddRange Method (Int32, Int32)[^].

Refer - How to increase download speed of the file from web-sites?[^]
引用:

根据服务器的不同,您可以通过几个segmen下载文件获得一些速度ts。

Depending on the server, you might gain some speed downloading the file with several segments.

为此你可以使用 request.AddRange 并有不同的线程来下载同一个文件。请注意,当您将数据写入本地文件时,您必须以正确的偏移量开始。

For that you can use request.AddRange and have different threads to download the same file. Note that when you write the data to a local file you must start in the correct offset.

这是大多数下载管理员所做的事情。

This is something that most download managers do.

请注意,有些服务器不允许这样做。

Note that some servers will not allow that.


这篇关于使用WebClient提高FTP服务器的文件下载速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆