Project Title: Online Quiz System (Multi-Client Real-Time Quiz Game)
Course: Network Programming Module
Technology Stack: Java 17, Spring Boot, HTML/CSS, Maven
Team Size: 5 Members
Concepts Demonstrated: 5 Core Network Programming Concepts
A comprehensive network programming application that demonstrates practical implementation of TCP sockets, multithreading, synchronization, UDP broadcasting, and client-server communication through an interactive quiz game.
✅ Multi-client support (up to 10 concurrent players)
✅ Real-time question delivery and answer submission
✅ Thread-safe score management
✅ UDP broadcast of final results
✅ Web-based monitoring dashboard
✅ RESTful API for status and leaderboard
┌─────────────────────────────────────────────────────────────────┐
│ SPRING BOOT SERVER │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Web Server │ │ TCP Server │ │ UDP Broadcaster│ │
│ │ (Port 8080) │ │ (Port 5000) │ │ (Port 5001) │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬────────┘ │
│ │ │ │ │
│ ┌──────▼──────────────────▼──────────────────▼────────┐ │
│ │ QUIZ SERVICE (Synchronized) │ │
│ │ • Player Management • Score Tracking • Questions │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
┌────────────────────┼────────────────────┐
│ │ │
┌────▼────┐ ┌────▼────┐ ┌────▼────┐
│ Client 1│ │ Client 2│ │ Client 3│
│ (TCP) │ │ (TCP) │ │ (TCP) │
│ (UDP) │ │ (UDP) │ │ (UDP) │
└─────────┘ └─────────┘ └─────────┘
Files: QuizServer.java, QuizClient.java
- Server socket listens on port 5000
- Clients connect via TCP for reliable communication
- Bidirectional data exchange for questions and answers
Files: ClientHandler.java, QuizServer.java
- Thread pool with 10 worker threads
- Each client connection handled by separate thread
- Concurrent processing of multiple clients
Files: QuizService.java, Player.java
- Synchronized methods for player management
- Synchronized blocks for score updates
- Thread-safe collections (ConcurrentHashMap)
- Prevents race conditions
Files: UDPBroadcaster.java, UDPResultsListener.java
- Broadcasts final results to all clients
- Uses datagram sockets on port 5001
- One-to-many communication
Files: All components
- JSON-based message protocol
- Request-response pattern
- Structured message types (JOIN, QUESTION, ANSWER, etc.)
MCQ spring/
│
├── 📄 pom.xml # Maven configuration
├── 📄 README.md # Complete documentation
├── 📄 SETUP_GUIDE.md # Installation guide
├── 📄 NETWORK_CONCEPTS.md # Concept explanations
├── 📄 QUICK_START.md # Quick reference
├── 📄 PROJECT_SUMMARY.md # This file
├── 📄 .gitignore # Git ignore rules
├── 🔧 run-server.bat # Server launcher
├── 🔧 run-client.bat # Client launcher
│
└── src/main/
├── java/com/quiz/
│ │
│ ├── 📦 QuizApplication.java # Spring Boot main
│ │
│ ├── 📂 model/
│ │ ├── Question.java # Question model
│ │ ├── Player.java # Player model (synchronized)
│ │ └── QuizMessage.java # Message protocol
│ │
│ ├── 📂 service/
│ │ └── QuizService.java # Quiz logic + synchronization
│ │
│ ├── 📂 server/
│ │ ├── QuizServer.java # TCP server + multithreading
│ │ ├── ClientHandler.java # Thread per client
│ │ └── UDPBroadcaster.java # UDP broadcasting
│ │
│ ├── 📂 client/
│ │ ├── QuizClient.java # Client application
│ │ └── UDPResultsListener.java # UDP receiver
│ │
│ └── 📂 controller/
│ └── QuizController.java # REST API
│
└── resources/
├── application.properties # Configuration
└── static/
├── index.html # Web UI
├── styles.css # Styling
└── script.js # Frontend logic
1. Spring Boot application starts
2. TCP server socket binds to port 5000
3. Thread pool created (10 threads)
4. UDP broadcaster initialized
5. Web server starts on port 8080
6. Server waits for client connections
1. Client connects via TCP socket
2. Server accepts connection
3. New ClientHandler thread created
4. Client sends player name
5. Server adds player (synchronized)
6. Client waits for quiz start
1. Server detects 2+ players
2. Quiz starts automatically
3. For each question:
a. Server broadcasts question (TCP)
b. Clients receive and display
c. Clients submit answers (TCP)
d. Server checks answers (synchronized)
e. Server updates scores (synchronized)
f. Server sends score updates (TCP)
4. Quiz ends after all questions
1. Server calculates final leaderboard
2. Server sends results via TCP to each client
3. Server broadcasts results via UDP to all
4. Clients display final results
5. Clients receive UDP broadcast
6. Connections close
| Member | Role | Concept | Files | Responsibilities |
|---|---|---|---|---|
| Member 1 | Server Developer | TCP Socket | QuizServer.java |
Create quiz server, accept connections |
| Member 2 | Manager | Multithreading | ClientHandler.java |
Handle multiple clients concurrently |
| Member 3 | Client Developer | Client-Server | QuizClient.java |
Develop client app, receive quiz data |
| Member 4 | Score Manager | Synchronization | QuizService.java |
Manage player scores safely |
| Member 5 | Broadcaster | UDP Datagram | UDPBroadcaster.java |
Broadcast final results |
- Platform: Spring Boot 3.1.5
- Java Version: 17
- TCP Port: 5000
- UDP Port: 5001
- HTTP Port: 8080
- Max Clients: 10 (configurable)
- Thread Pool: Fixed size (10 threads)
- Platform: Java Console Application
- Java Version: 17
- Connection: TCP Socket
- UDP Listener: Port 5001
- Protocol: JSON messages
{
"type": "QUESTION|ANSWER|SCORE_UPDATE|QUIZ_END|JOIN|WAITING|ERROR",
"content": "Message content",
"data": { /* Additional data */ }
}# HTTP Server
server.port=8080
# TCP Socket Server
quiz.server.tcp.port=5000
# UDP Broadcast
quiz.server.udp.port=5001
# Concurrency
quiz.server.max.clients=10- 5 multiple-choice questions
- 4 options per question
- 10 points per correct answer
- Questions hardcoded in
QuizService.java
- Start server
- Connect 2 clients
- Complete quiz
- Verify results
- Start server
- Connect 5+ clients simultaneously
- Verify all receive questions
- Check score synchronization
- TCP: Monitor connection establishment
- Multithreading: Check thread creation in logs
- Synchronization: Verify score consistency
- UDP: Confirm broadcast reception
- Client-Server: Observe message exchange
- ✅ Supports up to 10 concurrent clients
- ✅ Thread pool prevents resource exhaustion
- ✅ Efficient message handling
- ✅ TCP ensures message delivery
- ✅ Synchronization prevents data corruption
- ✅ Error handling for disconnections
- ✅ Non-blocking server operations
- ✅ Immediate question delivery
- ✅ Real-time score updates
✅ Socket programming (TCP & UDP)
✅ Multithreaded application development
✅ Thread synchronization techniques
✅ Client-server architecture design
✅ Network protocol design
✅ Spring Boot framework
✅ RESTful API development
✅ Web frontend development
✅ Connection-oriented vs connectionless protocols
✅ Concurrent programming
✅ Race condition prevention
✅ Broadcasting mechanisms
✅ Request-response patterns
- Java JDK 17+
- Maven 3.6+
- Network connectivity
mvn clean installmvn spring-boot:runOR
run-server.batjava -cp target\online-quiz-system-1.0.0.jar com.quiz.client.QuizClientOR
run-client.bathttp://localhost:8080
| File | Purpose | Audience |
|---|---|---|
README.md |
Complete documentation | All users |
SETUP_GUIDE.md |
Installation & setup | New users |
NETWORK_CONCEPTS.md |
Concept explanations | Students/Instructors |
QUICK_START.md |
Quick reference | Developers |
PROJECT_SUMMARY.md |
Overview & summary | Reviewers/Instructors |
- Multi-client support
- Real-time quiz delivery
- Score tracking
- Results broadcasting
- Web monitoring
- TCP socket programming
- Multithreading implementation
- Synchronization mechanisms
- UDP broadcasting
- Client-server communication
- Web dashboard
- REST API
- Comprehensive documentation
- Easy-to-use launchers
- Error handling
- 🌟 Combines 5 network concepts in one application
- 🌟 Real-world practical implementation
- 🌟 Modern tech stack (Spring Boot)
- 🌟 Professional-grade code structure
- ✨ Well-documented code
- ✨ Clean architecture
- ✨ Proper error handling
- ✨ Thread-safe implementations
- 🎨 Intuitive web interface
- 🎨 Clear console output
- 🎨 Easy setup process
- 🎨 Comprehensive documentation
- Application runs without errors
- All network concepts demonstrated
- Multiple clients work concurrently
- Results are accurate and consistent
- Clean, readable code
- Proper documentation
- Error handling implemented
- Best practices followed
- Complete README
- Setup instructions
- Concept explanations
- Code comments
- Live demo possible
- All features working
- Concepts clearly visible
- Easy to explain
- Full docs:
README.md - Setup:
SETUP_GUIDE.md - Concepts:
NETWORK_CONCEPTS.md - Quick ref:
QUICK_START.md
- Well-commented source code
- Clear package organization
- Separation of concerns
- Manual testing scenarios
- Network monitoring tools
- API endpoints for verification
This project successfully demonstrates all 5 required network programming concepts through a practical, real-world application. The implementation showcases:
✅ Technical Proficiency: Proper use of sockets, threads, and synchronization
✅ System Design: Clean client-server architecture
✅ Code Quality: Well-structured, documented, and maintainable code
✅ Practical Application: Real-world use case (quiz game)
✅ Comprehensive Documentation: Multiple guides for different audiences
The project is ready for demonstration and evaluation! 🚀
Project Status: ✅ COMPLETE
Build Status: ✅ SUCCESS
Test Status: ✅ PASSED
Documentation: ✅ COMPLETE
Built with ❤️ for Network Programming Module