11-24-2021 04:52 PM - edited 11-24-2021 04:57 PM
I have a real-time application on cRio-9054 where I would need to open a text file on host computer connected in network.
As example the file in host is "\\192.168.1.10\shared\config.ini"
I need to open it from cRio 192.168.1.50 or can I programmatically copy "config.ini" form HOST to cRio by RealTimeAPP ?
thank you
Michele
11-24-2021 08:12 PM
One "trick" in doing File I/O in an NI Real-Time Target is that the Target runs a Linux Real-Time OS. Among other things, the file system will seem a little strange to those with mainly Windows exposure. Notice that the format to Text files is also slightly different (EOL is slightly different).
I actually chose to do all of the I/O from the Host. There's something called WebDAV that can give the Host access to the File System of a Target, though you may need Admin access to the Target. I don't know all the details, but I think you can find information about WebDAV by "asking Google" (which will point you to the NI documentation).
Bob Schor
11-25-2021 12:45 AM
thank you Bob!
in my case I would like to open text file on HOST from labview RT application on target (not see TARGET file system from HOST but vice-versa)
as alternative I would maybe run on HOST a service that "syncronize" the directory of my interest from HOST to TARGET via FTP; but I was searching a more direct way just to open file on HOST.
have a nice day
Michele
11-25-2021 02:36 AM - edited 11-25-2021 02:40 AM
It depends a bit on how you plan to share the file from your host. If it is a normal Windows share, you would need to install samba on the cRIO. samba is a great tool but the underlying SMB (hence the name for the Linux software) protocol is also quite complex and was introduced long before someone even considered that network configurations could be zero-config (which is still mostly a marketing term and not exactly standard anywhere 😁).
And Unix/Linux solutions of such technologies tend to be always even a little more geeky then their Windows counterpart since almost every possible feature needs to be configurable. As such installing samba is easy, but getting it to work with your Windows computer nicely can be a bit of a challenge, depending on your Windows configuration. And with Windows nowadays trying to hide pretty much every configuration behind an "easy" to use minimalistic user interface, it can be quite a challenge to get all the necessary details to configure samba on a Linux computer to work properly with your Windows system.
But in order for this to work with modern Windows systems you should use LabVIEW 2020 or newer. Older versions do not have the necessary cifs-utils version to support SMB versions higher than 1.0 and that is for good reasons completely disabled on any modern Windows installation as it is considered very insecure.
Some threads of interest:
If your company uses Active Directory and you want to access a share on such a server, then things can get a whole order of magnitude more complicated.
Linux doesn't have Windows drive letters where you can mount a network share into, and in itself doesn't have UNC file names either. Instead a network share is simply mounted inside the file system at a specific mount point such as /network/MyShare and then accessed from there through normal file IO functions.