By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Detect Socket Client Disconnect

P: 3
Hi,

I'm having trouble detecting the client machine connection lost when the client physically pushes the power or restart button on their computer.

Using the code from Plater in the following thread: http://bytes.com/topic/net/answers/8...-socket-closed

I have managed to detect disconnect by the client when the client window form is closed, but if the client computer switches off or powers off, it doesn't detect a disconnect =(

What is the best way to detect this?
Feb 6 '09 #1
Share this Question
Share on Google+
1 Reply


Plater
Expert 5K+
P: 7,872
Hmm, I don't think I was aware that power loss didn't trigger the same way as a close.
Well, the old way was to try to do a read/write on the socket and see if it comes back with a timeout or an errorcode.

I don't really have a good way to test on power loss so I cannot poke around for ways it could happen
Feb 6 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.