Simple networked Tic-Tac-Toe. One server hosts the game, two clients can connect and play over TCP sockets. Default port: 27015.
- Server waits for two players, runs a 3x3 Tic-Tac-Toe game.
- Server sends board updates to both clients.
- Clients send moves (1-9) to the server when it's their turn.
- gcc (MinGW/MSYS2 on Windows, standard gcc on Linux/macOS)
- On Windows, link with ws2_32 (build script does this).
Windows (PowerShell):
- Run the provided script:
.\build.ps1
Linux / macOS:
- Make script executable and run:
chmod +x build.sh./build.sh
-
Start server:
- Windows:
.\server.exe - Unix:
./server
- Windows:
-
Start two clients (each in its own terminal):
- Windows:
.\client.exe <server-ip> - Unix:
./client <server-ip>Example (local):./client 127.0.0.1
- Windows:
When it's a clients turn you will be prompted: enter a number 1-9.
1 2 3
4 5 6
7 8 9