SFTP event handling for failed transfer

0 votes
asked Sep 28 by Prabhakar (390 points)

1) Does the event "ProblemDetected" get fired when during the SFTP file transfer error occurs?
2) Can we have a separate new event "TransferCompleted" for SFTP ?

Applies to: Rebex SFTP

1 Answer

0 votes
answered Oct 1 by Lukas Pokorny (96,250 points)
  1. The ProblemDetected event is only fired when a non-fatal problem is detected - it's not fired for transfer errors. When such error is encountered, the whole operation fails with SftpException. For a list of problems for which ProblemDetected event is fired, please see the TransferProblemType documentation.

  2. Completed transfer can already be detected using the existing TransferProgressChanged event - just check whether the event arguments TransferState property is equal to TransferProgressState.TransferCompleted in your event handler:

`

client.TransferProgressChanged += (sender, args) =>
{
    if (args.TransferState == TransferProgressState.TransferCompleted)
    {
        // transfer completed - do something
    }
};
...