forked from IF-LK-2020/wordle
not Valid Command und Willkommens und schlussnachricht hinzugefügt
This commit is contained in:
@@ -13,6 +13,9 @@ public class WordleServer extends Server {
|
||||
|
||||
private DatabaseConnector db;
|
||||
|
||||
private List<User> userList;
|
||||
private Query query;
|
||||
|
||||
|
||||
public WordleServer() {
|
||||
this(DEFAULT_PORT);
|
||||
@@ -20,23 +23,33 @@ public class WordleServer extends Server {
|
||||
|
||||
public WordleServer( int pPort ) {
|
||||
super(pPort);
|
||||
|
||||
query = new Query();
|
||||
db = new DatabaseConnector("", 0, "wordle.db", "", "");
|
||||
userList = new List<User>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processNewConnection( String pClientIP, int pClientPort ) {
|
||||
String connectionID= pClientIP +":"+ Integer.toString(pClientPort);
|
||||
User u = new User(connectionID);
|
||||
userList.append(u);
|
||||
send(pClientIP,pClientPort,"+OK Verbindung zum Wordle Server erfolgreich aufgebaut");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processClosingConnection( String pClientIP, int pClientPort ) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processMessage( String pClientIP, int pClientPort, String pMessage ) {
|
||||
|
||||
if(pMessage.equals("QUIT")){
|
||||
send(pClientIP,pClientPort,"+OK Bye");
|
||||
} else {
|
||||
send(pClientIP,pClientPort,"-ERR Command not valid in this state");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user