07-06-2022 12:13 AM
I have been using the new SFTP functionality to upload files from site to a SFTP server.
The SFTP functionality is not very well documented which made debugging SSH connections with pre shared keys unnecessarily difficult.
What is the correct way to get file upload progress as the SFTP gets locked up into the upload file vi.
The upload file vi also has a timeout which is an absolute timeout as opposed to timeout since last response from server. By using an absolute timeout I could apply the use the native SFTP resume download functionality. Is this possible in the state the SFTP vi's are at at the moment?
Can the status of upload be done by putting the upload file vi in a helper loop and then iteratively querying the file by listing directory contents or getting file attributes in a second loop?
Thank you for any assistance.
07-06-2022 06:05 AM
I'm afraid you can't do any of that. The SFTP functionality, just like the HTTP Client or SMTP Client library are black box implementations only exposing a synchronous API to the LabVIEW user. There is no asynchronous functionality available nor low level hooks to change what the API allows.
Considering that it uses under the hood libSSH (or libCurl for the HTTP Client library) it is unfortunate as those libraries would provide a much richter interface. But that was the choice of the NI developer who made those libraries. Probably to limit the scope of the implementation to make it a manageable work piece. Implementing asynchronous API support is a pretty open ended story that tends to never be really enough, no matter how you slice it, so the choice was likely to limit the scope to support 80% or so of the use cases and leave those needing more advanced solutions to deal with directly calling the underlying libraries themselves.
Maybe time to investigate the Encryption Compendium library?
07-06-2022 09:04 PM
Thanks Rolf
I have managed to implement a basic progress by:
A) Placing the upload file.vi in its own separate "helper" loop and
B) List directory.vi in a timeout helper loop which times out every few seconds to get the remote file size
It's a bit of a work around / overhead, but at least I can react if things go wrong before the upload file.vi timeout
By the way I thought of using the "get file attributes.vi" but if I wire the file attributes into a property node to read them nothing is displayed... if I probe the file attributes wire I see all the data... I assume this is a bug.
Cheers
07-07-2022 12:32 AM
If one of the properties produces an error, all subsequent properties will be skipped. You should be able to right click and select something like “Ignore internal Errors or similar.