[ 
https://issues.apache.org/jira/browse/SSHD-936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16898166#comment-16898166
 ] 

Goldstein Lyor commented on SSHD-936:
-------------------------------------

There is no such operation called "put" in the SFTP protocol - what the command 
does is OPEN + n * WRITE + CLOSE - all of them reflected by the 
{{SftpEventListener}}. Furthermore, surprisingly, there is such thing as a 
"successful" or "aborted" state of  a file transfer. There is no indication to 
the server how many bytes the client intends to write so there is no way to 
"track" the upload. The client might decide to close the transfer after having 
written only part of  the file due to some client-side reasons - the server 
will simply see the same OPEN+WRITE+CLOSE sequence as if the full file was 
transferred (less WRITE(s) of course). Furthermore, there is no "close reason 
code" to tell the server that this transfer has been aborted. Furthermore, the 
client might decide to send *more* than the actual file size (by re-sending the 
same block of data several times) and even send the data "out-of-sequence" - 
i.e., write block 100 before block 99.

I believe I have seen this request in the past and pretty much gave the same 
answer - if you want an all-or-nothing indication then SCP and SFTP is the way 
- in SCP the client tells the server how many bytes are going to be uploaded, 
and the server makes sure that *exact* number of bytes is sent. You can use an 
{{ScpTransferEventListener}} to monitor such transfers.

> Track SFTP put successful completion
> ------------------------------------
>
>                 Key: SSHD-936
>                 URL: https://issues.apache.org/jira/browse/SSHD-936
>             Project: MINA SSHD
>          Issue Type: Wish
>    Affects Versions: 2.1.0
>            Reporter: Logan
>            Priority: Major
>
> While we can track sftp events with SftpEventListener, there is no event/hook 
> to indicate the sftp put is completed successfully. "Successfully" here means 
> file transfer was done without being terminated/aborted for various reasons 
> (user intentional termination, broken connection because of network 
> error....). I think this was tried in earlier versions through 
> [FileUploadAware|[https://github.com/apache/mina-sshd/pull/11/files]]. Is 
> this something possible or just a limitation of protocol?
>  
> FYI - close method of SftpEventListener is called for successfully transfers 
> as well as aborted connections.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to