private void CopyStream(CobaltFile file, Stream stream) { var tries = 3; for (int i = 0; i < tries; i++) { try { GenericFdaStream myCobaltStream = new GenericFda(file.CobaltEndpoint, null).GetContentStream(); myCobaltStream.CopyTo(stream); break; } catch (Exception) { //unable to read update - save failed if (i == tries - 1) { throw; } //waiting for cobalt completion Thread.Sleep(50); } } }