Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Sitting in the server, I want to programmatically find out which all clients are connected to the print server. The list can be a superset , containing other client names/ips as well.

1) Is net sessions(NetSessionEnum or NetEnumConnection) reliable ?
2) Is WNetOpenEnum function reliable?
3) Is their any other way?

Kindly help.
Posted
Updated 27-Jan-15 0:02am
v2

1 solution

 
Share this answer
 
Comments
kaushik_code 27-Jan-15 4:20am    
Richard , Here is what I need:

- I am running the program on a print server.
- I want to get the IPs (or Hostname) of all the connected print clients which have made a connection to the print server.

Can you tell me what specific flags might help in this case?
Richard MacCutchan 27-Jan-15 4:55am    
Sorry that is a totally different issue. You may get some of the information from the netstat command.
kaushik_code 27-Jan-15 6:00am    
This will be way too much information. I have stumbled upon a function called NetConnectionEnum which seems to give what I exactly want. But I am unable to get results out of it. Any ideas?
Richard MacCutchan 27-Jan-15 6:12am    
Not really, since you have not given any clue as to what you are trying or what responses you get. Have you checked the documentation at https://msdn.microsoft.com/en-us/library/windows/desktop/bb525376(v=vs.85).aspx?
kaushik_code 27-Jan-15 7:08am    
NetConnectionEnum returns the connections to a particular share on a server. I am trying it on the local server. I have a printer shared on the local server and I have made a connection to that printer from a different machine. When I run my program on the local server , I expect NetConnectionEnum to return a positive value for "entriesread" , which is an out param. But the function returns success but entriesread =0.
Following are the parameters used.

1.servername = NULL
2.qualifier = share name of the printer.
3.level =1
4.bufptr = address of PCONNECTION_INFO_1 pointer.
5.prefmaxlen = MAX_PREFERRED_LENGTH
6.address of a DWORD.
7.address of a DWORD.
8.address of a DWORD.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900