11-30-2016 05:08 AM
Hi,
I am experiencing a rather annoying problem. My application usually run on network connected windows(10 or 7) computers. On startup I read several network paths from an INI-file, and use "Check if File of Folder Exists.vi" to verify the validity of the path. When computers running the software are connected to our network there are no issues. However, when a computer is offline, the "Check if File or Folder Exists.vi" does not seem to ever want to terminate. Apparantly there is no, or at least a way to generous, timeout on this process.
I tried the OpenG version, "File Exists.vi", and it also have similar issues, although it eventually terminated(10-20 minutes).
From previous issues with this VI I understand that the problem really is with the windows API, but could not NI add some reasonable timeout to the VI to ensure some predictable behaviour?
11-30-2016 07:33 AM
This sounds like a Good Idea for LabVIEW. If you look on the first page of the LabVIEW Forum, you'll see other Forums, including the Idea Exchange. Put this post on the LabVIEW Ideas, suggesting that they add an optional TimeOut input and TimedOut? Output on the Check if File or Folder Exists function (there's room on the Connector Panel for these connections). If enough people Kudo your suggestion, it can get incorporated into a later version of LabVIEW.
Bob Schor
11-30-2016 07:46 AM
Hi Bob,
I thoght about posting on Good Ideas. However, I believe this is some sort of bug and posted it here to see if there were any response and if someone had a workaround. I'll post something in Good Ideas too 🙂
By the way, I added code to identify and extract the network computer name from the path, ran that into the "String to IP"-function and added a test to not run the "Check if File or Folder Exists.vi" if the IP returned as "0". This solved my problem!
02-06-2017 09:24 AM
Hi Treigstad,
I appreciate this is an old thread. If your subscribed and still active, can you tell me how to identify and extract the network computer name from the path. I have the same problem, I would like to avoid my application hanging when a shared drive is unavailable.
Brian
02-06-2017 10:31 AM
If you are using Windows, you can use Windows' API instead.
Take a look this thread:
02-06-2017 10:45 AM
sounds interesting, is it easy to use WindowsAPI from LabVIEW? I'm not seeing many examples on the LV forums.
02-06-2017 11:00 AM
02-07-2017 12:38 AM
Hi bmann200,
This is what I did:
Basically I strip the computer name from the string converted path and then validate it using the String to IP.vi.
02-09-2017 06:26 AM
Many thanks Treigstad, that works, problem solved, I can see if the Network PC is available or not.
When I read \\PCname\folder\folder\file from file, the LV "string to path" function converts it to C:\PCname\folder\folder\file because the file read removes a backslash from the start of the string. I'm now having to write a VI that determines if the path if a drive letter or backslash, and add a backslash back in if it's the later.