Server nimmt nun Nachrichten an und Schickt diese zurück.

This commit is contained in:
eichehome 2021-05-14 20:02:26 +02:00
parent 6f39b1ba46
commit e0ee8be9f6
5 changed files with 90 additions and 16 deletions

View file

@ -30,7 +30,7 @@ public class ServerHandelClientsThread extends Thread {
private Socket clientSocket = null;
private ClientMessageStore centralMessageStore = null;
private PrintWriter pr = null;
private PipedReader pipe = null;
@Override
public void run() {
@ -56,17 +56,23 @@ public class ServerHandelClientsThread extends Thread {
Thread.currentThread().interrupt();
} catch (SocketException ex) {
System.err.println("Socket geschlossen");
centralMessageStore.removeClient(this);
continueLoop = false;
} catch (EOFException ex) {
System.err.println("Fehler: " + ex);
continueLoop = false;
} catch (IOException ex) {
System.err.println("Exeption: " + ex);
Logger.getLogger(ServerHandelClientsThread.class.getName()).log(Level.SEVERE, null, ex);
centralMessageStore.removeClient(this);
continueLoop = false;
}
}
}
public ServerHandelClientsThread(Socket socket, ClientMessageStore messageStore) {
clientSocket = socket;
centralMessageStore = messageStore;
public ServerHandelClientsThread(Socket socket, ClientMessageStore messageStore, PipedReader pipe) {
this.clientSocket = socket;
this.centralMessageStore = messageStore;
this.pipe = pipe;
}
}