Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Feature: File Transfer Progress [1324]

$
0
0
<p>** Added Issue as status PROPOSED type FEATURE **</p>
<p>This is a discussion thread.</p>
<p>&nbsp;</p>
<p>Is there any interest in including a way to expose current transfer progress to an application?</p>
<p>&nbsp;</p>
<p>For example, imagine a user wanting to upload a file could pass in an implementation of:</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>public interface IFileTransferHandler</p>
<p>{</p>
<p> ulong BytesRead { get; }</p>
<p>&nbsp;</p>
<p> void IncrementBytesRead(ulong bytes);</p>
<p>&nbsp;</p>
<p> void TransferCompleted();</p>
<p>}</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>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&#39;re passing in streams, there&#39;s no objective way to determine</p>
<p> the file size so that would have to be provided in the implementation, if at all.</p>
<p>&nbsp;</p>
<p>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&#39;ve managed to</p>
<p> build a sample implementation for sftp upload, so this method works). The only issue is if the handler throws an exception. Since it&#39;s asynchronous the debugger displays the stack trace in the wrong place and could confuse developers.</p>

Comments: ** Comment from web user: olegkap **

Also, I changed the logic so now it will report only number of bytes actually uploaded to the server.


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>