Code Monkey home page Code Monkey logo

Comments (6)

volks73 avatar volks73 commented on June 9, 2024

@ngblume This is not necessarily a bug with the implementation, but perhaps a bug in documentation and lacking examples.

The SFTP Attributes:Create.vi creates an empty struct within the libssh2lv C library. This is unpopulated with actual, meaningful data about a file. The SFTP File:Read Status.vi must be used to populate the empty Attributes struct. Structs are like clusters in LabVIEW. Before the SFTP File:Read Status.vi is called, the SFTP Attributes can be whatever the libssh2 C library decided to use during struct initialization. It appears random values are used.

The following VI snippet should work, or at least be useful as a template to read the attributes of a file through the SFTP API:

SFTPFile_Attributes_Example

If you have the source code and Caraya Unit Test package installed, then the Tests.lvlib:SFTP File.lvlib:Read Status.vi test might be useful since a more complete, "official" example is not currently available.

from libssh2-labview.

volks73 avatar volks73 commented on June 9, 2024

Hmm, looking at the SFTP examples, specifically Simple SFTP File Download, it appears I made the same mistake and did not call the Read Status.vi before reading the attributes. I am in the process of fixing this example.

from libssh2-labview.

volks73 avatar volks73 commented on June 9, 2024

I have updated the Simple SFTP File Download example to use the Read Status.vi as of ff8facd. I will hold off on creating a new release until I get confirmation this has been resolved.

from libssh2-labview.

ngblume avatar ngblume commented on June 9, 2024

@volks73 That's exactly the example I based my code on.

I think for the Simple SFTP File Download.vi it makes even more sense to use the "Read Size.vi", since it contains all necessary steps and this should be a simple example with very little risk of errors..
image

I changed my code and it works properly now...
Except the timestamp is weird..
The context help says UNIX epoch, which for me means directly convertable in LabVIEW...
But that's not what I'm seeing...
The file was changed yesterday..
Somehow it is off by 66 years...
image
image

from libssh2-labview.

volks73 avatar volks73 commented on June 9, 2024

@ngblume Ha! I forgot about the Read Size.vi. I have a vague memory of adding that VI because reading the file size is such a common need and the lower level SFTP Attributes API is a little cumbersome. I have changed the example to use the simpler Read Size.vi as of 30b943e.

I believe it is a UNIX timestamp, which uses 1970 as the epoch year, but LabVIEW on Windows (not sure about macOS or Linux) uses 1904 as the epoch year. I thought a UNIX timestamp was directly convertable as well, but maybe I was thinking of a UTC timestamp.

from libssh2-labview.

ngblume avatar ngblume commented on June 9, 2024

Fixed that offset in my code
Seems fixed for me...
New release could be created...
Thanks !

from libssh2-labview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.