J
John
When my client connects to my server application, the client
"registers" by passing a reference to itself to the server. The server
stores these references in an ArrayList so that when it needs to push
information to the client it can.
The problem I'm having is developing an elegant solution to handle
when a client goes away. Right now I catch a SocketException which is
thrown when the server tries to push data to the client. When I catch
this exception I remove the client reference from my ArrayList.
Is there a better way to detect when the client goes away without
having to try and send data to it?
I know I can "deregister" when the client quits, but this doesn't
handle the case when the network connection is lost or the client
crashes.
I'd also like for the client to know when the server has gone away
(crashed or network connection lost).
THANKS!
John
"registers" by passing a reference to itself to the server. The server
stores these references in an ArrayList so that when it needs to push
information to the client it can.
The problem I'm having is developing an elegant solution to handle
when a client goes away. Right now I catch a SocketException which is
thrown when the server tries to push data to the client. When I catch
this exception I remove the client reference from my ArrayList.
Is there a better way to detect when the client goes away without
having to try and send data to it?
I know I can "deregister" when the client quits, but this doesn't
handle the case when the network connection is lost or the client
crashes.
I'd also like for the client to know when the server has gone away
(crashed or network connection lost).
THANKS!
John