🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages Started by Mike K Sun, 18 Mar 2007 14:48
Validating a UNC path?
#2261
Author: Mike K
Date: Sun, 18 Mar 2007 14:48
21 lines
1754 bytes
Anyone know how to determine at runtime if a UNC path spec is currently 
valid? My app is sleeping for up to a minute trying to find a folder in 
a UNC path that points to a volume that is offline. I'm using 
DirectoryExists() for this, and this function works fine for local 
volumes, but IF its pathspec is UNC and IF the target volume is not on 
the network at the moment, this function takes a minute or two to time 
out, and the rest of the app is waiting to execute until this function 
returns. DirectoryExists() works fine for valid UNC paths:


String logpath;
    logpath = "C:\\log_files\\";
    if(DirectoryExists(logpath))OpenLogFile();     // this is no problem

    logpath = "\\\\FILESERV\\logs\\";
    if(DirectoryExists(logpath))OpenLogFile();

If FILESERV is offline, this function has to timeout before control is 
passed back to your app.

Is there some alternative to DirectoryExists()?
Re: Validating a UNC path?
#2263
Author: Koen
Date: Mon, 19 Mar 2007 09:44
6 lines
876 bytes
Mike K wrote:

> Is there some alternative to DirectoryExists()?

I don't know, but you could enumerate the computers in the network, and 
test if the computer the unc-path is pointing to is found in the network.
Re: Validating a UNC path?
#2266
Author: Mike K
Date: Mon, 19 Mar 2007 12:33
4 lines
1041 bytes
Koen wrote:
> I don't know, but you could enumerate the computers in the network, 

How would you do that? Is there an API call for it?
Re: Validating a UNC path?
#2269
Author: Koen
Date: Mon, 19 Mar 2007 16:19
14 lines
1312 bytes
Mike K wrote:

> Koen wrote:
>> I don't know, but you could enumerate the computers in the network, 
> 
> How would you do that? Is there an API call for it?
> 
> 

http://groups.google.com/groups/search?q=enumerate+network+group%
3Aborland.public.cppbuilder.*&qt_s=Search+Groups

Basicly, you'll need a recursive function using WNetOpenEnum and 
WNetEnumResource to retrieve the computernames.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads