Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Slow detection of absent UNC
Message
From
18/11/2007 21:02:43
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01269426
Message ID:
01269822
Views:
19
>>>When a built-in function like DIRECTORY(), FILE() or FCREATE() is passed a UNC-path that does not (no longer) exist, it takes a very long time to tell you that. Is there an API function that can tell this much quicker?
>>
>>Hi Peter
>>
>>I don't know whether this works with UNC Paths but you can try. I too found this problem long ago and after that started using DISKSPACE(). This returns a -1 immediately if the path is not found and the DiskSize if found. No waiting. The reply is instant.
>>
>>Try it and see.
>
>That one too is slow.
>
Actually this command is slow only for UNC paths since the Network has to look up the IP in the DNS server and this is what takes time.

For a mapped drive, this returns an answer instantly.

Try this for yourself ?DISKSPACE("s:\") where s is some drive letter that is NOT mapped. Answer returns -1 instantly.

If you prefer NOT using a mapped drive then you have a number of other options.

Lets say that you have a share like this - \\Myserver\MyVFPShare

Then ?DISKSPACE("\\Myserver\MyVFPShare") is fast and if the share does not exist, you get a delay of only 1/2 second which I tested on my network of about 300+ computers.

Another option is you can use the IP address. This is fast since DNS does not need to be looked up - DISKSPACE("\\192.168.233.125\c$") where c$ is the hidden share or you could use an actual share name.

These methods I mentioned above are faster that the file based search FILE().
Previous
Reply
Map
View

Click here to load this message in the networking platform