I am building a Windows console application that, after logic is performed on files they are transferred over FTP individually (we are dealing with thousands of files here) These files are relatively small (~50kb), so the login, transfer, logout of the FTP function does take a considerable amount of time, especially when multiplied against 1000's of files.
The FTP server cannot accept more than (for example) 10 simultaneous connections.
I have had a couple of ideas what would be the best course of action:
- I am a Unity3D programmer and Coroutines sound like a perfect way to handle this. Simply loop through starting coroutines (increasing a variable ActiveConnections), then waiting for ActiveConnections to become >10 and repeating the process. Are coroutines possible in VS? I am not having any luck with it...
- Starting another process/app solely for FTP connections, creating and destroying this console app for each file. The problem is A, it isn't very efficient (of course) and B. how am I going to manage the amount of Active connections stored in the ActiveConnections var in the main program?
Can anyone help me build on either of these ideas or possible suggest something better?
Thanks in advance!