how to detect disconnected/crashed clients from the server?
views:
220answers:
1Seriously unclear question. Any chance you could clarify your question? You migth get a more useful and specific answer.
Do you mean: gee, I'm trying to RDP on to my server and some rude jerk is camping out so I can't get in? In which case this might help: No squatting on my servers!. Basically these will take care of it: Query session /server:[servername] Logoff [sessionid] /server:[servername]
Or do you mean: gee, I've written a TCP base serviced and clients keep dieing and not disconnecting their sessions correctly? In which case the simplest method is to send a heartbeat every second that requires the client to respond with in a set amount of time. Failure to respond means they have crashed or improperly disconnected. In which case you need to clean up on your end. rude.
Or perhaps you have a web-app or similar UDP type service. Those are a bit harder, but most forums seem to do a ok job of deciding who is connected by looking at their last activity. So in ASP.NET you could put a Module in the pipeline that updates the user record with a time stamp each time they make a request. Inside your app you look at the timestamp and see if it is older than some timeout value. If it is older then they have disconnected or crashed. The same approach basically works for a web-service or other SOAP type application.
Any chance you could clarify your question? You migth get a more useful and specific answer.