I am uploading thousands of files to a server.
The server connection breaks allot, so I need a way for this console application to be able to recover if the connection fails for a few seconds etc.
My application is simple, it just gets all the files in the c:\uploads folder and then uses a web service to upload the files to the server.
so:
foreach(string file in files)
{
UploadToServer(file);
}
How can I make this so it re-covers in the event of a connection failure? (failures usually last just a few seconds)
Use a little helper method that retries the upload several times before throwing in the towel. For example:
Tweak the exception handling code as needed.