SftpTransferProgressChangedEventArgs.CurrentFileBytesTransferred and BytesTransferred

+1 vote
asked Apr 22, 2015 by maynero (390 points)

I can't seem to find the difference with SftpTransferProgressChangedEventArgs.CurrentFileBytesTransferred and SftpTransferProgressChangedEventArgs.BytesTransferred. Can someone explain please?

1 Answer

0 votes
answered Apr 23, 2015 by Tomas Knopp (58,890 points)
selected Apr 23, 2015 by maynero
Best answer

The TransferProgressChanged event is used for single file operations (PutFile, GetFile, etc.) but also for the multi-file operations (Upload, Download) that can transfer multiple files with one method call.

The CurrentFileBytesTransferred property "Gets the total number of bytes transferred during the transfer of the current file." So in case of multi file operation this property gets reset with each new file transfer.

whereas the BytesTransferred property "Gets the total number of bytes transferred.", i.e. here it is counting all bytes of all transferred files together.

Consequently, for the singe-file operations, the CurrentFileBytesTransferred and
BytesTransferred properties yield the same results which might seem to be strange, but it is correct and you will only notice the different behavior with the advanced multiple file operations.

commented Apr 23, 2015 by maynero (390 points)
thank you :) that clear evertyhing
commented Apr 23, 2015 by Tomas Knopp (58,890 points)
good, thanks! :)