Detecting Loss of Client With CSockets
-
Is there an easy way for a server, implemented with CSockets, to know when one or more clients have disconnected antisocially e.g. network unplugged, powered off etc? I want to prevent a build up of 'obsolete' CSockets in my servers client list. TIA ;)
-
Is there an easy way for a server, implemented with CSockets, to know when one or more clients have disconnected antisocially e.g. network unplugged, powered off etc? I want to prevent a build up of 'obsolete' CSockets in my servers client list. TIA ;)
Use CAsyncSocket instead of CSocket and handler OnClose() event.
-
Use CAsyncSocket instead of CSocket and handler OnClose() event.
Great thanks! Can't I can still use CSocket as this is subclassed from CAsyncSocket? Thanks again! Tony :cool:
-
Use CAsyncSocket instead of CSocket and handler OnClose() event.
He's right, but it doesn't work in all cases: client --- router ---- router -- server ^ break connection here If the network connection is broken between the client and server here, neither receives an error until they try to send data. Depending on how things are setup in your app, you might want to consider doing a ping message.