File Transfer Progress

Sep 14, 2012 at 4:41 AM

Is there any interest in including a way to expose current transfer progress to an application?

For example, imagine a user wanting to upload a file could pass in an implementation of:

public interface IFileTransferHandler
{
    ulong BytesRead { get; }

    void IncrementBytesRead(ulong bytes);

    void TransferCompleted();
}

Whenever the callback for Write returns confirming that the bytes were written, IncrementReadBytes would be called and whenever the file is fully uploaded TransferCompleted gets called. Since we're passing in streams, there's no objective way to determine the file size so that would have to be provided in the implementation, if at all.

All you really need to do is add a field for that interface in SftpFileStream and then pass it to all calls to RequestWrite and then create some new constructors so that the interface can be passed along from the publicly exposed methods (I've managed to build a sample implementation for sftp upload, so this method works). The only issue is if the handler throws an exception. Since it's asynchronous the debugger displays the stack trace in the wrong place and could confuse developers.

Sep 14, 2012 at 7:37 AM

There is always an interest for improvement!

If you could implement what you have for upload/download, make a patch and upload it I'll see how to get it in! 

Sep 14, 2012 at 3:34 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Sep 15, 2012 at 6:55 AM

Hey kenneth, what's the recommended format for a patch? Line-by-line diff? Just upload the files changed (mirrored in the folder structure)?

Sep 15, 2012 at 8:31 AM
What ever you are comfortable with:)

On Saturday, September 15, 2012, nemec wrote:

From: nemec

Hey kenneth, what's the recommended format for a patch? Line-by-line diff? Just upload the files changed (mirrored in the folder structure)?

Read the full discussion online.

To add a post to this discussion, reply to this email (sshnet@discussions.codeplex.com)

To start a new discussion for this project, email sshnet@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Sep 15, 2012 at 6:49 PM

Okay I've uploaded a patch. It was a surprisingly simple change thanks to the original AsyncCallback that you exposed before!