Since last week iam trying building an multiplayer game. iam statring with a little tictactoe game. I made a simple socket connection between server and client. On the server side iam making 2 thread for each connection. - readThread and writerThread Now whats the best way sending commands to server and put them to ressource whos needing them. iam thing about the strategy pattern, but is this the right scenario? The command i sended to the server should calling another component on the server. example
public abstract class Command {
abstract void execute();
}
public class LoginCommand extends Command{
ServerMethodeInterface serverMethodeInterface;
private String name;
private String passwort;
LoginCommand(String name, String password){
this.name = name;
this.passwort = password;
}
@Override
void execute() {
serverMethodeInterface.login(name,password);
}
}