0 votes
by (160 points)

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
        e.Action = FtpBatchTransferAction.Retry
        e.Action = FtpBatchTransferAction.ThrowException
    End If
End Sub

1 Answer

0 votes
by (58.9k points)

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.