// This method is called when a request has been made to close a client connection public synchronized void disconnectClient(ClientConnection clientConnection) { // Ensures this connection exists (a necessary check when this is being called from outside of a // clientConnection) if (clientConnection != null && clientConnection.isConnected() && clientSocketList.get(clientSocketList.indexOf(clientConnection)) != null) { // Send the client a message telling it to close its socket clientConnection.xmitMessage(ClientConnection.QUIT); // Then close that socket...the user really doesn't have a choice. We're just asking to be // nice. clientSocketList.get(clientSocketList.indexOf(clientConnection)).closeSocket(); parent.updateStatusBox( clientSocketList.indexOf(clientConnection) + " " + "Forcing disconnection of client " + clientConnection.id + " on port " + port + "..."); } else { // If this thread is NOT connected, it may be stuck, so let's send an interrupt to wake it up clientThreadList.get(clientSocketList.indexOf(clientConnection)).interrupt(); parent.updateStatusBox("Closing listen socket on port " + port + "..."); } }