Get the Online Quiz System running in 5 minutes!
cd "e:\MCQ spring"
mvn clean install⏱️ Wait for "BUILD SUCCESS"
# Option A: Using batch file (Windows)
run-server.bat
# Option B: Using Maven
mvn spring-boot:run✅ Wait for "Quiz Server Started on Port: 5000"
# Option A: Using batch file (Windows)
run-client.bat
# Option B: Using Java
java -cp target\online-quiz-system-1.0.0.jar com.quiz.client.QuizClient✅ Enter player name when prompted
- Server: Automatically starts when 2+ players join
- Clients: Answer questions (1-4)
- Results: View scores in console + UDP broadcast
Open browser: http://localhost:8080
- View server status
- Monitor active players
- See live leaderboard
- Refresh automatically every 5 seconds
MCQ spring/
├── pom.xml # Maven config
├── run-server.bat # Start server (Windows)
├── run-client.bat # Start client (Windows)
├── README.md # Full documentation
├── SETUP_GUIDE.md # Detailed setup
├── NETWORK_CONCEPTS.md # Concept explanations
└── src/main/
├── java/com/quiz/
│ ├── QuizApplication.java # Main Spring Boot app
│ ├── model/ # Data models
│ ├── service/ # Business logic
│ ├── server/ # Server components
│ ├── client/ # Client application
│ └── controller/ # REST APIs
└── resources/
├── application.properties # Configuration
└── static/ # Web UI files
| # | Concept | File | Description |
|---|---|---|---|
| 1 | TCP Socket | QuizServer.java |
Reliable client-server connection |
| 2 | Multithreading | ClientHandler.java |
Concurrent client handling |
| 3 | Synchronization | QuizService.java |
Thread-safe score management |
| 4 | UDP Broadcasting | UDPBroadcaster.java |
Final results broadcast |
| 5 | Client-Server | QuizClient.java |
Bidirectional communication |
File: src/main/resources/application.properties
server.port=8080 # Web server port
quiz.server.tcp.port=5000 # TCP socket port
quiz.server.udp.port=5001 # UDP broadcast port
quiz.server.max.clients=10 # Max concurrent clients# Windows
netstat -ano | findstr :5000
taskkill /PID <process_id> /F- Ensure server is running
- Check firewall settings
- Verify ports 5000, 5001, 8080 are open
mvn clean install -U- Install JDK 17+
- Install Maven 3.6+
- Add to PATH environment variable
- Restart terminal
- Server starts successfully
- Web UI loads (http://localhost:8080)
- 2+ clients can connect
- Questions display correctly
- Answers are submitted
- Scores update properly
- Final results shown
- UDP broadcast received
- Build project beforehand
- Test with 3-5 clients
- Keep terminals organized
- Have web dashboard open
- Show Architecture (README.md diagram)
- Start Server (show console output)
- Open Web Dashboard (show live monitoring)
- Connect Clients (show multiple terminals)
- Play Quiz (demonstrate flow)
- Show Results (TCP + UDP)
- Explain Code (highlight key concepts)
- ✅ TCP for reliable question/answer exchange
- ✅ Multithreading handles 10+ concurrent clients
- ✅ Synchronization prevents score corruption
- ✅ UDP broadcasts results efficiently
- ✅ Clean client-server architecture
Your Code: QuizServer.java
ServerSocket serverSocket = new ServerSocket(tcpPort);
Socket clientSocket = serverSocket.accept();Explain: How TCP establishes reliable connections
Your Code: ClientHandler.java
public class ClientHandler implements Runnable {
@Override
public void run() { ... }
}Explain: How each client runs in separate thread
Your Code: QuizClient.java
Socket socket = new Socket(SERVER_HOST, SERVER_PORT);Explain: How client communicates with server
Your Code: QuizService.java
public synchronized boolean addPlayer(...) { ... }
synchronized (scoreLock) { ... }Explain: How synchronization prevents race conditions
Your Code: UDPBroadcaster.java
DatagramSocket socket = new DatagramSocket();
socket.setBroadcast(true);
DatagramPacket packet = new DatagramPacket(...);
socket.send(packet);Explain: How UDP broadcasts to all clients
# Build
mvn clean install
# Run Server
mvn spring-boot:run
# OR
run-server.bat
# Run Client
java -cp target\online-quiz-system-1.0.0.jar com.quiz.client.QuizClient
# OR
run-client.bat
# Check Server Status
curl http://localhost:8080/api/quiz/info
# View Leaderboard
curl http://localhost:8080/api/quiz/leaderboard
# Find Process on Port
netstat -ano | findstr :5000
# Kill Process
taskkill /PID <process_id> /F- README.md - Complete project documentation
- SETUP_GUIDE.md - Detailed installation guide
- NETWORK_CONCEPTS.md - In-depth concept explanations
- QUICK_START.md - This file (quick reference)
Your setup is working when you see:
Server Console:
===========================================
Quiz Server Started on Port: 5000
Waiting for clients to connect...
===========================================
Player joined: Alice (uuid-1234)
Player joined: Bob (uuid-5678)
Starting quiz with 2 players
Client Console:
Connected to Quiz Server!
Enter your name: Alice
Waiting for other players... (2 players connected)
Question 1 of 5
What is 2 + 2?
1. 3
2. 4
3. 5
4. 6
Your answer (1-4):
Web Dashboard:
- Status: RUNNING ✅
- TCP Port: 5000 ✅
- UDP Port: 5001 ✅
- Active Players: 2+ ✅
Everything is set up and ready to run. Good luck with your project presentation!
Need more details? Check the other documentation files:
- Full docs:
README.md - Setup help:
SETUP_GUIDE.md - Concepts:
NETWORK_CONCEPTS.md