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 ?
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.
ProblemDetected
SftpException
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:
TransferProgressChanged
TransferState
TransferProgressState.TransferCompleted
`
client.TransferProgressChanged += (sender, args) => { if (args.TransferState == TransferProgressState.TransferCompleted) { // transfer completed - do something } };
Welcome to Q&A forum for C# and VB.NET developers working with following .NET components:
Applications:
If you need immediate assistance, please contact us directly.