|
@@ -25,7 +25,6 @@ public class Client extends Thread {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
while (!isInterrupted()) {
|
|
|
-
|
|
|
try {
|
|
|
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
|
|
|
|
|
@@ -42,15 +41,16 @@ public class Client extends Thread {
|
|
|
System.out.print("\033[1;31m\033[40m " + t.Name + ": \u001B[0m ");
|
|
|
System.out.println(t.Message);
|
|
|
|
|
|
- } catch (IOException exception) {
|
|
|
- System.out.println(exception.getMessage());
|
|
|
- clientList.remove(this);
|
|
|
- break;
|
|
|
- } catch (ClassNotFoundException exception) {
|
|
|
- System.out.print("Не смог прочитать данные клиента " + socket.getRemoteSocketAddress().toString() + ": ");
|
|
|
+ } catch (IOException | ClassNotFoundException exception) {
|
|
|
System.out.println(exception.getMessage());
|
|
|
clientList.remove(this);
|
|
|
- break;
|
|
|
+ System.out.println("Disconnected user " + socket.getRemoteSocketAddress().toString());
|
|
|
+ try {
|
|
|
+ socket.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
}
|