B4J Question SFTP and Wait for

imbault

Well-Known Member
Licensed User
Longtime User
Hi,
Is there a way to do a wait for using SFTP, because I do not see any return object in the oSFTP.UploadFile ?

Thanks
 

MarkusR

Well-Known Member
Licensed User
Longtime User
should be an event UploadCompleted,
so you would wait for this event.
UploadFile (DeviceFolder As String, DeviceFile As String, ServerFilePath As String)
Uploads a file to the server. The UploadCompleted event will be raised when upload completes.
UploadProgress events will be raised during the upload.
DeviceFolder - Local folder.
DeviceFile - Local file name.
ServerFilePath - Full path to file that will be created on the server.
https://www.b4x.com/b4j/help/jsch.html#sftp_uploadfile
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can always wait for events, even if there is no "sender filter" object.

B4X:
SFTP.UploadFile(...)
Wait For SFTP_UploadCompleted (...)

This will work as long as you are not trying to upload multiple files at once. In that case only the last event will be raised.
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
Sorry Erel, what kind of paramaters do I have to put in (....) for
Wait For SFTP_UploadCompleted (...)
?

Thanks
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Sorry Erel, what kind of paramaters do I have to put in (....) for
Wait For SFTP_UploadCompleted (...)
?

Thanks

you can use the TAB key to enter the library events as if you were creating a new sub. anyway it is exactly the same parameters (you can change names of them) as a regular sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The event is raised from the library when a upload finishes

See the documentation for a list of all events and their signature!
https://www.b4x.com/b4j/help/jsch.html#sftp

Given you did set the eventprefix to sftp then its signature is
B4X:
sub sftp_UploadCompleted (ServerPath As String, Success As Boolean)
end sub
 
Upvote 0
Top