Programatically 'wake up' connection to remote disk?

Posted on 2010-03-26
Medium Priority
Last Modified: 2013-11-20
My application ( C++, MFC, MS 6.0 ) when attempting to open a file, will make a call on using CFileStatus to see if it exists.  If it does, I open it.  No issue on local disks.  However, often, but not always, my app will say that a file on a networked disk does not exist.  If I go out to windows, and surf over to that remote disk, opening it once -- then my app will be able to open the file on that remote disk.  It will continue working for a while, but at some point, it again fails.
Maybe because someone rebooted the remote system, maybe something times out, not sure.
The point is, I would like to programmatically do the equivalent of what I do manually when I go to 'My Computer', and click on the remote disk, which seems to 'wake up' the connection to it.
In case it helps, I always have a "drive letter" defined to these remote disks.
Question by:tullhead
  • 4
  • 2

Expert Comment

ID: 28711505
I don't know if there is a more 'modern' solution, but this thread suggests a way of forcing a reconnect.


( I think the problem is occuring because Windows disconnects a mapped drive after a period of inactivity. Accessing in Explorer forces a reconnect)
LVL 11

Expert Comment

ID: 28753178
Do your machines have "wake on LAN" network cards?  Have a look at http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/

It means that as long as the machine has power, even if it has shutdown, it can be started up.

You can force windows not to disconnect by switching off the power save on the adapter.

Author Comment

ID: 29113029
j-horb - this is exactly what I'm talking about.  It would be very hlepful to me to see a small bit of sample code - just looking at the definitions in MSDN is a little hard for me, though I may try to slug it out.  Know of any sample code?
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Expert Comment

ID: 29116622
There is some example code on MSDN, e.g here (scroll down for the example).

Accepted Solution

j-horb earned 2000 total points
ID: 29116655

Expert Comment

ID: 29116840

Author Closing Comment

ID: 31707693
I haven't got around to try it, but it looks to be exactly what I need, so I'll declare this an good answer!  Thanks!

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question