在下载使用的FtpWebRequest .NET中一个FTP连接多个目录中的文件 [英] Downloading files from multiple directory in one FTP Connection with FTPWebRequest in .NET

查看:120
本文介绍了在下载使用的FtpWebRequest .NET中一个FTP连接多个目录中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改FTP会话的路径一旦会话打开。我想这样做的原因是为了避免打开多个FTP连接。整个目的是下载在一个FTP连接位于FTP站点的文件。例如,在一个FTP连接,我想从全部位于FTP站点的目录下载的内容及时间。目前,我有项目失败日常生活,因为它使多个连接到FTP站点,从不同的目录中下载文件。例如,使超过80连接在1分钟。

Is it possible to change the Path of the FTP session once the Session is Open. The reason I want to do this is to avoid to open the multiple FTP connection. The whole purpose is to download the files located in the FTP site in a single FTP connection. For example, in single FTP connection, I want download the contens from all the directory located in the FTP site. Currently, I have project that is failing everyday because It makes multiple connections to the FTP site to download files from different directory . For example, making more than 80 connections in 1 minutes.

什么的FtpWebRequest的.NET限制

What are restrictions of the FTPWebRequest in .NET

推荐答案

中为每个的的FtpWebRequest

多FtpWebRequests重用现有的   连接,如果可能的话。

Multiple FtpWebRequests reuse existing connections, if possible.

诚然,这并不真正告诉你很多,但如果你的文档中的 ConnectionGroupName 属性,它会告诉你,你可以为了重复使用的连接指定相同ConnectionGroupName多个请求。

Admittedly that does not really tell you much but if you look at the documentation for the ConnectionGroupName property, it tells you that you can specify the same ConnectionGroupName for multiple requests in order to reuse the connection.

下面是管理连接在.NET。

另外,你应该能够使用WebClient类发出多个相关FTP请求,虽然我不能肯定地说,我会想象它会重复使用的连接。不像的FtpWebRequest只能使用一次,Web客户端可以被用来制造多个请求。

Alternatively, you should be able to use the WebClient class to issue multiple related FTP requests and although I can't say for sure, I would imagine that it would reuse the connection. Unlike FtpWebRequest which can only be used once, WebClient can be used to make multiple requests.

这篇关于在下载使用的FtpWebRequest .NET中一个FTP连接多个目录中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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