TODO in CLient: automate/hide connecting sequence in Client Constructor.

Added Comment to ClientHandler that the constructor atm implements connecting logic.
This commit is contained in:
Sebastian Lenzlinger 2022-03-25 11:27:41 +01:00
parent 47703e481e
commit 03d4942552
2 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,7 @@ public class Client {
this.in = new BufferedReader((new InputStreamReader((socket.getInputStream())))); this.in = new BufferedReader((new InputStreamReader((socket.getInputStream()))));
//TODO add the system based generated username here. //TODO add the system based generated username here.
//TODO hide connecting logik(next 4 lines)
this.userName = userName; this.userName = userName;
this.out.write(getUsername()); this.out.write(getUsername());
this.out.newLine(); this.out.newLine();

View File

@ -15,6 +15,11 @@ public class ClientHandler implements Runnable {
public static HashSet<ClientHandler> inGameClients = new HashSet<>(); public static HashSet<ClientHandler> inGameClients = new HashSet<>();
public static HashSet<ClientHandler> ghostClients = new HashSet<>(); public static HashSet<ClientHandler> ghostClients = new HashSet<>();
/**
* Implements the connecting logik in client-server
* architecture.
* @param socket
*/
public ClientHandler(Socket socket) { public ClientHandler(Socket socket) {
try { try {
this.socket = socket; this.socket = socket;