如何重用的FtpWebRequest连接 [英] How to Reuse FtpWebRequest Connection

查看:159
本文介绍了如何重用的FtpWebRequest连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要列出成千上万的FTP服务器上的文件,并删除必要的。正如您可以猜到,性能是必不可少的,所以我需要一种方法来重复使用的FTP连接。

I need to list thousands of files on FTP server, and delete the necessary ones. As you can guess, performance is essential, so I need a way to reuse the FTP connection.

没有足够的解释,在MSDN上关于FtpWebRequests的连接使用!它只是说多FtpWebRequests重用现有的连接,如果可能的话。什么是如果可能是什么意思?我想控制何时关闭连接,就这么简单!你知道吗?

There is not enough explanation on MSDN about the connection usage of FtpWebRequests! It only says "Multiple FtpWebRequests reuse existing connections, if possible." What does "if possible" mean? I want to control when to close connection, simple as that! Any idea?

问候

推荐答案

previous连接到服务器的如果可能的话,只要重新用作的KeepAlive 参数来的HttpWebRequest 对象设置为。这种优化的发生多的HttpWebRequest对象的创建和使用的下面。

Previous connections to the server are reused if possible as long as the KeepAlive parameter to the HttpWebRequest object is set to true.This optimization happens underneath the creation and use of multiple HttpWebRequest objects.

对于多线程操作,上有一个特定的主机并发连接数的限制。

With respect to multithreaded operations, there is a limit on the number of concurrent connection to a particular host.

<一个href="http://stackoverflow.com/questions/388908/improving-performance-of-multithreaded-httpwebrequests-in-net"><$c$c>System.Net.ServicePointManager.DefaultConnectionLimit可用于增加并发连接

System.Net.ServicePointManager.DefaultConnectionLimit can used to increase concurrent connections

  • <一个href="http://stackoverflow.com/questions/1016690/how-to-improve-the-performance-of-ftpwebrequest?answertab=votes#tab-top">How改善的FtpWebRequest的性能?

这篇关于如何重用的FtpWebRequest连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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