Getting fuzzyyy. Added LLIST server response. cannot continue.

This commit is contained in:
Sebastian Lenzlinger 2022-04-08 19:47:27 +02:00
parent e9cade1528
commit 7df07b490a
5 changed files with 25 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.ClientPinger;
import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.Protocol; import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.Protocol;
import ch.unibas.dmi.dbis.cs108.sebaschi.CentralClientData;
import java.net.Socket; import java.net.Socket;
import java.io.*; import java.io.*;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@ -23,6 +24,8 @@ public class Client {
private BufferedWriter out; private BufferedWriter out;
public ClientPinger clientPinger; public ClientPinger clientPinger;
private CentralClientData data;
public Client(Socket socket) { public Client(Socket socket) {
try { try {
this.socket = socket; this.socket = socket;
@ -177,6 +180,10 @@ public class Client {
} }
public CentralClientData getData(){
return this.data;
}
public Socket getSocket() { public Socket getSocket() {
return socket; return socket;
} }

View File

@ -50,6 +50,7 @@ public class JClientProtocolParser {
System.out.println("Human received Vote request"); System.out.println("Human received Vote request");
//TODO(Seraina): How can be enforced, that clients won't vote otherwise? Trigger a methode here that listens to input //TODO(Seraina): How can be enforced, that clients won't vote otherwise? Trigger a methode here that listens to input
break; break;
case Protocol.serverDeliversLobbyList:
default: default:
System.out.println("Received unknown command"); System.out.println("Received unknown command");
} }

View File

@ -100,5 +100,10 @@ public class Protocol {
*/ */
public static final String serverRequestsHumanVote = "HVOTR"; public static final String serverRequestsHumanVote = "HVOTR";
/**
* todo: doch
*/
public static final String serverDeliversLobbyList = "LLIST";
} }

View File

@ -29,6 +29,8 @@ Implemented:
* SPING Ping from server to client * SPING Ping from server to client
* PINGB Pingback from client to server. * PINGB Pingback from client to server.
* QUITC Confirms to the client that they are being disconnected from the server. * QUITC Confirms to the client that they are being disconnected from the server.
* LLIST$LobbyIDAndAdmin
Response to LISTL. Parameter is a string.
Future / planned: Future / planned:
* MSGRS "Message received": Paramaters: a string detailing to the client that and what the server received as command. * MSGRS "Message received": Paramaters: a string detailing to the client that and what the server received as command.

View File

@ -0,0 +1,10 @@
package ch.unibas.dmi.dbis.cs108.sebaschi;
/**
* Each Clients copy of data. In principle it is CentralServerData.
* The Client must update himself.
*/
public class CentralClientData extends CentralServerData{
}