Page 1 of 1

SFTPСlient - abort download/upload a large file

Posted: Wed 18 Jul 2018 15:25
by alexer2
How to make a correct abort download-upload a large file in SFTPСlient?
Do this in the onData event? can you give the code?

Re: SFTPСlient - abort download/upload a large file

Posted: Thu 19 Jul 2018 11:34
by ViktorV
SecureBridge does not allow you to cancel the operation of downloading/loading a file.
If you want us to add this functionality, please write about it at our User Voice forum: https://devart.uservoice.com/forums/174370-securebridge. If your suggestion gets enough votes, we will consider the possibility of its implementation.

Re: SFTPСlient - abort download/upload a large file

Posted: Thu 19 Jul 2018 13:34
by alexer2
This is a failure. This is the basic function in file operations....

Re: SFTPСlient - abort download/upload a large file

Posted: Thu 19 Jul 2018 17:05
by alexer2
I found this solution
viewtopic.php?t=19149
it seems to work.

Code: Select all

procedure TSFTPClientFrame.ScSFTPClientSuccess(Sender: TObject;
  Operation: TScSFTPOperation; const FileName: string;
  const Handle: TArray<System.Byte>; const Message: string);
begin
  if IfNeedAbort then
    raise Exception.Create('Custom break file operation');
end;
Is this the right solution to my question?

Re: SFTPСlient - abort download/upload a large file

Posted: Fri 20 Jul 2018 08:43
by ViktorV
You can use this code to solve the task.

Re: SFTPСlient - abort download/upload a large file

Posted: Thu 26 Jul 2018 20:05
by stlcours
Yes, please add a function/property to abort upload/download. It is very necessary and not a big work, so I don't think it need a separate vote for this functionality. Thanks.

Re: SFTPСlient - abort download/upload a large file

Posted: Tue 11 Sep 2018 14:34
by ViktorV
If we add a parameter to the event handler, this will change the standard behavior of this component, which has been used by our users for many years and this will affect all of them. Therefore, we asked you to write about it at https://devart.uservoice.com/forums/174370-securebridge. If your suggestion gets enough votes, we will consider the possibility of its implementation.

Re: SFTPСlient - abort download/upload a large file

Posted: Wed 24 Feb 2021 20:42
by stlcours
Could you add a new event to realize this function? So it will not change the old versions, but it is really very useful.

Re: SFTPСlient - abort download/upload a large file

Posted: Fri 26 Feb 2021 13:39
by ViktorV
We'll try to add it in the next version of SecureBridge.

Re: SFTPСlient - abort download/upload a large file

Posted: Mon 29 Mar 2021 09:39
by ViktorV
We have added this functionality. This dobavleniet enter the new build SecureBridge, which we plan to release this week.
Now, to solve your issue, you can use the TScSFTPClient.BeforeReadData and TScSFTPClient.BeforeWriteDataEx event handlers.