mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
TicTacToeServer
This commit is contained in:
@@ -31,7 +31,7 @@ public class TcpServer implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
logger.info("Server listening on port " + port);
|
logger.info("Server listening on port {}", port);
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
Socket clientSocket = this.serverSocket.accept();
|
Socket clientSocket = this.serverSocket.accept();
|
||||||
@@ -61,6 +61,7 @@ public class TcpServer implements Runnable {
|
|||||||
|
|
||||||
private void stopWorkers() {
|
private void stopWorkers() {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
|
this.receivedQueue.clear();
|
||||||
this.sendQueue.clear();
|
this.sendQueue.clear();
|
||||||
this.executor.shutdownNow();
|
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