0 votes
by (160 points)
edited

I'm trying to force a retry with a 30 minute delay when an FTP Upload fails due to connectivity issues. Here's a snippet of my code. Is this how the retry is to be used in conjuction with the BatchTransferProblemDetected event?

Sub RetryUpload(ByVal sender As Object, ByVal e As FtpBatchTransferProblemDetectedEventArgs)
    'Wait 30 minutes and try again
    'Do this for the next 4 hours before failing
    Retries += 1
    If Retries < 9 Then
        System.Threading.Thread.Sleep(1800000)
        e.Action = FtpBatchTransferAction.Retry
    Else
        e.Action = FtpBatchTransferAction.ThrowException
    End If
End Sub

1 Answer

0 votes
by (58.9k points)
edited

Well in fact, the whole batch transfer (including handling problems with BatchTransferProblemDetected event) is done within one FTP session.

So if a problem is detected during batch transfer, we would not advise to perform a long Thread.Sleep(). You must take into account that after 30 minutes of session inactivity the server would probably consider that the connection was dropped and disconnect your FTP client.

...