LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

FileExists and UNC path

I've noticed a strange behaviour of FileExists(const char path[], ssize_t **fileSize) function with UNC paths (\\<hostname>\<sharename>[\<objectname>]*😞

  • if <hostname> is an alias of a non-existent host, FileExists returns 0 (File not found) - for example FileExists("\\\\server-name\\folder-name\\file.txt", NULL)
  • if <hostname> is an unreachable IP address, FileExists return -93 (UIEIOError) - for example FileExists("\\\\192.168.1.1\\folder-name\\file.txt", NULL)

This happens also if you try with the path to the same file, written with the host IP address and its corresponding alias, when the host becomes unreachable.

Tested with CVI 2009 SP1

 

Is this an expected behaviour?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 12
(7,013 Views)

Hello Vix,

 

I've tried with either CVI 2009  Version 9.1.1 (450) and CVI 2009 Version 9.1.0 (428) and I always get 0 if the alias is bad or the IP is unreachable.

Here's the code I've run:

 

 

int ret=0;
ret=FileExists ("\\\\it-mil-wds01\\AEs\\pippo.txt", NULL);
printf("Il valore e' %d",ret);
getchar();

 


int ret=0;

ret=FileExists ("\\\\server\\AEs\\pippo.txt", NULL);

printf("Il valore e' %d",ret);

 getchar();

 

Can you give me your exact version of CVI?

 

Thanks,

 

Andrea

Andrea N.
Principal Applications Engineer - Semiconductor EMEA
National Instruments Italy
Certified LabVIEW Architect - Certified TestStand Architect
0 Kudos
Message 2 of 12
(6,989 Views)

Probably I didn't explain the problem very well:

if you use an alias, you'll always get 0.

But if you use the IP address of the alias, you'll get -93.

 

  1. Launch the shell command "ping server" so you can see which is the real IP address of the alias called "server"
  2. If the IP address of "server" alias is 10.2.2.2, for example
  • FileExists ("\\\\server\\AEs\\pippo.txt", NULL); returns 0
  • FileExists ("\\\\10.2.2.2\\AEs\\pippo.txt", NULL); returns -93

and the strange thing is that server is simply an alias for 10.2.2.2

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 12
(6,985 Views)

Hello Vix,

 

now I did the correct test but I always get 0 either with the alias or the IP Address (of the same alias).

 

What version of CVI are you using?

 

Ciao,

 

Andrea

Andrea N.
Principal Applications Engineer - Semiconductor EMEA
National Instruments Italy
Certified LabVIEW Architect - Certified TestStand Architect
0 Kudos
Message 4 of 12
(6,974 Views)

I used both CVI 6.0 and CVI 2009 SP1 under WinXP Pro SP2.

Did you get 0 when the network address isn't availbale?

Or when the file doesn't exist, but the network resource (alias or IP Address) is availbale?

 

I found this issue while simulating a kind of network fault simply unplugging my network cable

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 5 of 12
(6,942 Views)

The file exists and just lik you did I unplugged the network cable but I always got 0, eithe with alias or IP address...

Andrea N.
Principal Applications Engineer - Semiconductor EMEA
National Instruments Italy
Certified LabVIEW Architect - Certified TestStand Architect
0 Kudos
Message 6 of 12
(6,939 Views)

This is really strange, because I find the same situation on several PCs connected to different LANs.

The behavioir doesn't change both in debug and in release configuration...

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 7 of 12
(6,937 Views)

I have an additional information that could help you reproducing this issue:

  • install CVI in a Win XP virtualized through Oracle Virtualbox (I used VirtualBox 3.2.10)
  • add a second virtual Hard Disk to the Controller IDE - IDE Primary Slave
  • assign the letter D:\ to this second hard disk
  • use FileExists( ) to test for the existence of a non existent file in this disk... you should have error -93
Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 8 of 12
(6,738 Views)

Has been this issue reproduced and/or fixed yet?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 9 of 12
(6,424 Views)

I can't seem to reproduce this even with a VirtualBox XP system. Have you tried this without a virtual machine? Virtual machines tend to be a source of many networking issues.

 

I am assuming that if you can connect to the server, and the file exists you do get a 1. Is that correct? Are you only getting unexpected behavior when you cannot access the server?

 

Could you enable logging for the CVI RTE by running C:\Program Files (x86)\National Instruments\CVI2010\bin\ConfigCVILogging.exe (at the correct path on your system and for your version). This will launch an application where you can turn on logging message types. Set the  radio button at the top to Runtime Engine and then check all of the message types and output the log to a file. Could you send me this log. Maybe to make it easier for me to read, create one for each scenario. This will help me figure out where to look to see why you might be getting the -93 error.

National Instruments
0 Kudos
Message 10 of 12
(6,396 Views)