Browse Source

Check connection to server before closing

remotes/origin/feature/client/exchange-messages-between-client-server
Alena Bandarovich 11 months ago
parent
commit
efbf5ad6c8
  1. 2
      src/main/java/ChatClient.java

2
src/main/java/ChatClient.java

@ -61,11 +61,13 @@ public class ChatClient extends JFrame implements KeyListener {
} catch (IOException e) { } catch (IOException e) {
JOptionPane.showMessageDialog(null, "Verbindung zum Server \"" + address + "\" fehlgeschlagen."); JOptionPane.showMessageDialog(null, "Verbindung zum Server \"" + address + "\" fehlgeschlagen.");
} finally { } finally {
if (null != connectionToServer) {
try { try {
connectionToServer.close(); connectionToServer.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}
try { try {
fromServerReader.close(); fromServerReader.close();

Loading…
Cancel
Save