Fix: error managing in TCP client
This commit is contained in:
@@ -87,7 +87,14 @@ public class TCPClient implements IClient {
|
||||
private void receiveMessage() {
|
||||
while (true) {
|
||||
try {
|
||||
Object read = socketReceive.readObject();
|
||||
Object read;
|
||||
try {
|
||||
read = socketReceive.readObject();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
break;
|
||||
}
|
||||
|
||||
if (read instanceof NetworkEvent event) { //TODO: avoid instanceof
|
||||
if (event.getIsError()) {
|
||||
System.out.println(event);
|
||||
@@ -99,7 +106,7 @@ public class TCPClient implements IClient {
|
||||
controller.setModel(model);
|
||||
controller.view.render();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user