Closed mcpat-it closed 6 years ago
The Parallel class is designed to multi-thread classes that are thread-safe or can be multi-threaded. The FtpClient by design cannot be used this way because most FTP servers require a unique session per client interaction (e.g. unique login and session and only one active operation per session).
https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/potential-pitfalls-in-data-and-task-parallelism
If you want to use the FtpClient in a multi-threaded way you will need to create multiple FtpClient instances each with its own unique session to the FTP server and then call the GetFile() method on each one of those unique instances.
Ok thank you for the answer!
Hi,
If I use parralel.for then the download isn't working.
Regards MCPAt