Programmatically (Win32/MFC) checking the status of mapped network

S

Sudesh Shetty

Hi

How can I programmatically (Win32/MFC) check the status of mapped
network(i.e. server is connected or disconnected)?

We have a local server to which many clients can be connected.
I have connected to this server and mapped to particular drive(say Z:\).
In the server we can get all the Client IP which are connected to this
server(Control Panel/Administrative tools/Computer Management/Shared
folders/Sessions). Here we can disconnect a particular client.

I have to check the status of this server(mapped network) in my client
Even if we disconnect the client in server, the mapped drive still exists in
my client.
So API's like GetLogicaldrive,GetLogicalDriveStrings,_access fails to give
the right status. Which API I can use to get the right status?

One more information- When client is disconnected in the server, if I use
"net use" cmd promt in client it shows status is "Disconnected". But still I
can write some file to the mapped drive using fopen(),fwrite() and this
file will be reflected in the server also. I am more confused by this
behavior.
Can anyone help me to resolve this issue?

Best Regards
Sudesh
 
B

Bistey Csaba

Sudesh said:
Hi

How can I programmatically (Win32/MFC) check the status of mapped
network(i.e. server is connected or disconnected)?

We have a local server to which many clients can be connected.
I have connected to this server and mapped to particular drive(say Z:\).
In the server we can get all the Client IP which are connected to this
server(Control Panel/Administrative tools/Computer Management/Shared
folders/Sessions). Here we can disconnect a particular client.

I have to check the status of this server(mapped network) in my client
Even if we disconnect the client in server, the mapped drive still exists in
my client.
So API's like GetLogicaldrive,GetLogicalDriveStrings,_access fails to give
the right status. Which API I can use to get the right status?

One possible solution for your problem is WNetGetConnection function:

Described here: http://msdn2.microsoft.com/en-us/library/aa385453.aspx
Example to use it here:
http://msdn2.microsoft.com/en-us/library/aa385374.aspx

Another one is NetUseGetInfo function.
Described here: http://msdn2.microsoft.com/en-us/library/Aa370648.aspx

Csaba
 
S

Sudesh Shetty

Bistey Csaba said:
One possible solution for your problem is WNetGetConnection function:

Described here: http://msdn2.microsoft.com/en-us/library/aa385453.aspx
Example to use it here:
http://msdn2.microsoft.com/en-us/library/aa385374.aspx

Another one is NetUseGetInfo function.
Described here: http://msdn2.microsoft.com/en-us/library/Aa370648.aspx

Csaba


Hi
Thanks for your reply.
But this didn't resolve my issue.
WNetGetConnection(), NetUseGetInfo() returns same value in both the
cases(connected, disconnected).
Regards
Sudesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top