Hello everyone, I am working on a server and client pair and they connect just fine my problem is that the server needs to detect when the client disconnects. Right not I am using
socket.isConnected()
and also I am creating a dataoutput stream and writting the int 700 to it. If the output stream returns an error or isConnected returns false it is supposed to kick that client off of the server.
This is were the problem begins. If the clients computer is shut down or the process is ended then this works perfectly fine but if the client computer goes to sleep the server doesnt detect that the client is no longer connected and when the computer wakes up there is no connection or a new one is established.
Is there anyway that I can detect if the computer is going to sleep client sided and close the socket from there or any other ways to see if the client is still connected?