Downloading files from multiple directory in one FTP Connection with FTPWebRequest in .NET

只愿长相守 提交于 2019-12-03 14:38:12

As per the documentation for FtpWebRequest:

Multiple FtpWebRequests reuse existing connections, if possible.

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.

Here is more information on managing connections in .NET.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!