mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
TicTacToeServer
This commit is contained in:
@@ -31,7 +31,7 @@ public class TcpServer implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
logger.info("Server listening on port " + port);
|
||||
logger.info("Server listening on port {}", port);
|
||||
|
||||
while (running) {
|
||||
Socket clientSocket = this.serverSocket.accept();
|
||||
@@ -61,6 +61,7 @@ public class TcpServer implements Runnable {
|
||||
|
||||
private void stopWorkers() {
|
||||
this.running = false;
|
||||
this.receivedQueue.clear();
|
||||
this.sendQueue.clear();
|
||||
this.executor.shutdownNow();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.toop.server.backend.tictactoe;
|
||||
|
||||
import org.toop.server.backend.TcpServer;
|
||||
import org.toop.game.TTT;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TicTacToeServer extends TcpServer {
|
||||
public TicTacToeServer(int port) throws IOException {
|
||||
super(port);
|
||||
}
|
||||
|
||||
private void gameThread(String main_character, String opponent_character) {
|
||||
TTT ticTacToe = new TTT(main_character, opponent_character);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user