TransferProgressChanged event is always triggered twice when progress percentage is 100

0 votes
asked Feb 2, 2017 by jflores (150 points)

TransferProgressChanged event is always triggered twice when progress percentage is 100, Do you know why it behaves of this way?

thanks in advance.

Applies to: Rebex SFTP

1 Answer

0 votes
answered Feb 3, 2017 by Lukas Matyska (47,890 points)

Please note, that the SftpTransferProgressChangedEventArgs object contains TransferState property. It tells you, in which state the event was raised.

The first 100% occurred in state DataBlockProcessed. The second one occurred in state FileTransferred.

For a small file, the TransferProgressChanged event will raise with this values:

FileTransferring: 0%
DataBlockProcessed: 100%
FileTransferred: 100%

In multi file operation (Download or Upload method) it will look like this:

FileTransferring: 0%
DataBlockProcessed: 100%
FileTransferred: 100%
TransferCompleted: 100%
...