×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Directory validation

Directory validation

Directory validation

(OP)
I have a remote connection to a server using a VPN

I need to validate folders when connected.

When I use the UNC path to the folder, the Directory() command hangs for about a minute if the VPN connection is not active, but returns true when connected and the folder exists

CODE

Example:

lcDir='\\192.168.1.250\SomeFolder'
IF DIRECTORY(lcDir)
return .t.
ENDIF

Is there a better way to validate folders?

RE: Directory validation

You *might* get better performance using fcreate() trying to create a file there, but failure wouldn't actually tell you whether the directory exists. You just might not have rights.

The long hang isn't coming from Foxpro. It's just waiting for the operating system, and Windows has a long timeout on this type of thing.

RE: Directory validation

How long does it take if the vpn is connected but the folder does not exist?

Perhaps you could check the vpn is active first?

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Directory validation

(OP)
Hi Griff,
I just tested your question:
when connected to the VPN, if a folder does not exist the response time for a folder that does not exist is normal.
The issue only arises when the vpn is not connected.
So I need to validate the connection before testing for a folder.

Alastair

RE: Directory validation

(OP)
OK, further testing is as follows:
Once the connection has disconnected and windows has registered that the vpn is not connected (And the VPN adapter has changed state to 'not connected'), then directory validation returns false with no delay.
The problem lies with the time it takes for windows to register that the VPN is not connected. That period of time is when the hang occurs.
So I need a way to avoid my program from hanging if it tries to access the VPN during this disconnection period.

EDIT: The above is not correct - another test when disconnected and the DIRECTORY command hung again.


Alastair

RE: Directory validation

(OP)
I am having a look at the Windows command 'net use' which returns a list of connected networks.
I may be able to use that first to validate the connection. I will report back.

RE: Directory validation

(OP)
Hi
I am stuck with connecting to a VPN

I can start the VPN connection using rasdial.exe
But in my validation process I need to 'activate' the unc path some way. for instance if I type the path into an explorer window and push enter, or from the start menu bring up the run dialog and type the unc path and push enter, the network appears instantly in the network list, and my validation process returns true.

I am stuck on what should be a very simple process - how can I program a command in VFP to make this last step happen?

RE: Directory validation

Can you do a shellexecute to open a window and do that?

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Directory validation

(OP)
Hi Griff,
I am trying, but cant seem to get that to work.
I guess the less windows that open the better, if I can activate the directory silently that would be better.
I only have used shellexecute to open default programs, so will have to have a look at it closer to make it work

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close