This project implements a multi-player Mastermind game using a client–server architecture in C, demonstrating practical skills in network programming, concurrency handling, and real-time communication. It was built on Linux using TCP for control messages and UDP for gameplay, showcasing strong understanding of low-level socket operations and system programming.
See the demo video below for a quick visual explanation of how the system works.
Full system description referenced from project documentation.
Architecture Summary
- TCP: Login, commands, matchmaking, state updates
- UDP: Real-time gameplay messaging
- Server: Tracks online players, pending requests, game sessions
- Clients: Handle gameplay logic + UI interaction
- 🌐 Client–server architecture using TCP & UDP
- 🧩 Turn-based Mastermind gameplay
- 🕒 60-second timeout system
- 👥 Multi-client support
- 📝 Command-based interface
- 🛡️ Username & session validation
- 🔄 Real-time updates between two players
| Command | Description |
|---|---|
!help |
Show all commands |
!who |
List online players |
!start <user> |
Send a match request |
!accept / !reject |
Respond to match requests |
!combination |
Submit your guess |
!disconnect |
Leave the match |
!quit |
Exit the server |
- Linux OS (Ubuntu, Fedora, etc.)
- GCC Compiler
- Make utility
# Compile
make -f makefile
# Run server
./MServer 127.0.0.1 1234
# Run client (in new terminal)
./MClient 127.0.0.1 1234MServer.c # Server program
MClient.c # Client program
makefile # Build instructions
README.md # Documentation- Developed and tested on Fedora Linux.
- Uses numerical symbols (0–9) instead of colours for Mastermind logic.
- Based on coursework requirements documented in the assignment.
This project is licensed under the MIT License. See the LICENSE file for details.
Copyright (c) 2021 Sadeep Dilshan KasthuriarachchiIf you reference this work, please cite:
Kasthuriarachchi, S.D. (2024) Client-Server Mastermind Game. GitHub repository. Available at: https://github.com/sadeep654/Client-Server-Mastermind-Game (Accessed: date-you-accessed).Feel free to explore, fork, or reach out for collaboration or opportunities.


