简体   繁体   中英

How to check if a network connection is still alive when using WNetAddConnection2

So in my code I make a network connection to a linux share with different credentials using WNetAddConnection2. It could be the case the while my code is up, the network becomes unstable and drops the connection externally from my code.

My question is, given the path to the share, how can I check if my connection is still up? I tried WNetGetConnection but it didnt get me anywhere. Is there a way to do this?

The path which I connect to looks like this:

\\someserver\somefolder\someotherfolder 

Just checking if you can access the files/folders attributes should be enough for most uses. WNetGetUser can be used to verify the username used by the connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM