In a client/server setup, I'm meant to be able to detect if a client disconnects, and remove the client from the list of clients on the server. I can do this in all instances, except for if the server is waiting for an input from the client.
For example, the client terminates the process, when the server is on this part of its loop:
int target = Integer.parseInt(Scanner.next())
For writing, I have that solved. Using the PrintWriter's checkError method, I can tell if there has been an issue writing to the client, and thus kill the connection since the client has disconnected. Is there a similar option for using the scanner, or an alternative class that has this functionality which I can use?