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.
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?
Regards
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.
System.Net.ServicePointManager.DefaultConnectionLimit
can used to increase concurrent connections
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With