Click to See Complete Forum and Search --> : Disconnecting computers connected thru LAN


lexcis27
December 17th, 2004, 03:55 AM
Hi. I was able to determine who are connected to my pc. Is it possible to disconnect someone connected to me? It will be a great help if someone can show me how. :sick:

-Lexcis27

NoHero
December 17th, 2004, 06:13 AM
Everytime you use 'accept' to allow somebody connection to you, you get a socket handle as a return value. Just 'close' this socket to close the connection.

lexcis27
December 17th, 2004, 04:46 PM
No I was not using WinSock in establishing connection to the connecting pc. I determined who are connected to me by calling NetShareEnum. The problem is I don't know how to disconnect a client from me based on the parameters returned by NetShareEnum.

j0nas
December 17th, 2004, 06:03 PM
You're probably thinking about LanMan network sessions. In that case, use the following Session Functions:
NetSessionDel
NetSessionEnum
NetSessionGetInfo

lexcis27
December 19th, 2004, 08:29 PM
Yeah, in fact I've used the NetSessionDel API. What happens is, the function returns successfully but the shared folder window on the client pc is still open. Is it possible that after closing the session with the connecting pc, the explorer window accessing the shared resource should be closed also? Thanks.

j0nas
December 22nd, 2004, 04:00 AM
Yeah, in fact I've used the NetSessionDel API. What happens is, the function returns successfully but the shared folder window on the client pc is still open. Is it possible that after closing the session with the connecting pc, the explorer window accessing the shared resource should be closed also? Thanks.
The window is opened, but the session is closed. No, it's not possible to remotly close explorer's window.

lexcis27
December 23rd, 2004, 01:43 AM
I see.. Thanks Jonas for the quick response.. Gladly appreciate it.