๐ GitHub Repository:
https://github.com/vyawaha/java-chat-app-socket-programming.git
A real-time client-server chat application built using Java Socket Programming that allows multiple users to communicate simultaneously through TCP sockets.
The project demonstrates practical implementation of:
- Client-server architecture
- TCP socket communication
- Multithreading
- Real-time message exchange
- Public broadcasting
- Private messaging
- User management
- Chat history logging
Modern applications such as messaging platforms, multiplayer games, customer support systems, collaboration tools, and notification systems rely heavily on real-time communication.
This project implements the fundamental networking concepts behind these systems by creating a centralized Java chat server where multiple clients can connect, communicate, and exchange messages in real time.
| Category | Details |
|---|---|
| Project Name | Chat App with Socket Programming |
| Language | Java |
| Project Type | Networking / Backend Application |
| Communication | TCP Socket Programming |
| Architecture | Client-Server Architecture |
| Concurrency | Multithreading |
| Storage | File Based Chat Logging |
| Repository | https://github.com/vyawaha/java-chat-app-socket-programming.git |
Design and develop a real-time chat application where:
- Multiple clients can connect to one server
- Users can send messages simultaneously
- Messages are delivered instantly
- Users can communicate privately
- Server manages client connections
- Chat activity is stored for future reference
โ
TCP socket based communication
โ
Client-server architecture
โ
Multiple client support
โ
Real-time message exchange
โ
Username identification
โ
Join notification
โ
Leave notification
โ
Public message broadcasting
โ
Private messaging
โ
Chat history logging
โ
Graceful client disconnect
โ
Exception handling
Client 1
|
|
Socket
|
|
Client 2 ---- Java Chat Server ---- Client 3
|
|
Client Handler Threads
|
|
Message Broadcasting
|
|
Chat History Logger
Client Starts
โ
Connects to Server using Socket
โ
Server Accepts Connection
โ
Client Handler Thread Created
โ
User Enters Username
โ
Messages Sent To Server
โ
Server Processes Message
โ
Broadcast / Private Delivery
โ
Message Logged
| Technology | Purpose |
|---|---|
| Java | Programming Language |
| Socket API | Network Communication |
| ServerSocket | Server Connection Handling |
| Thread | Concurrent Client Handling |
| BufferedReader | Reading Input |
| PrintWriter | Sending Output |
| File Handling | Chat Logging |
| Git/GitHub | Version Control |
Used for communication between client and server.
Used by the server to listen for incoming client connections.
Each client connection runs independently using a separate thread.
ArrayList is used to maintain active connected clients.
Used to safely access shared client data.
Handles network failures and unexpected disconnections.
java-chat-app-socket-programming
โ
โโโ src
โ โ
โ โโโ server
โ โ โโโ ChatServer.java
โ โ โโโ ClientHandler.java
โ โ
โ โโโ client
โ โ โโโ ChatClient.java
โ โ
โ โโโ common
โ โโโ ChatLogger.java
โ
โโโ logs
โ โโโ chat_history.txt
โ
โโโ screenshots
โ
โโโ docs
โ โโโ Testing_Report.md
โ
โโโ README.md
โโโ LICENSE
โโโ .gitignore
Install:
- Java JDK 17 or above
- Git
- VS Code / IntelliJ IDEA / Eclipse
Check Java:
java -versionFrom project root:
javac -d out src\common\*.java src\server\*.java src\client\*.javaOpen Terminal 1:
java -cp out server.ChatServerOutput:
==============================
Java Chat Server
==============================
Server started successfully.
Listening on port : 5000
Waiting for clients...
Open Terminal 2:
java -cp out client.ChatClientUsername:
Alice
Open Terminal 3:
java -cp out client.ChatClientUsername:
Bob
Open Terminal 4:
java -cp out client.ChatClientUsername:
Charlie
Type:
Hello everyone
Output:
Alice: Hello everyone
Format:
@username message
Example:
@Bob Hello Bob
Only Bob receives:
[Private] Alice: Hello Bob
All messages are stored in:
logs/chat_history.txt
Example:
Alice joined the chat
Bob joined the chat
Alice: Hello everyone
[Private] Alice: Hello Bob
Bob left the chat
- Start Java Chat Server
java -cp out server.ChatServer
- Connect multiple clients:
Alice
Bob
Charlie
- Test communication:
- Send public messages
- Send private messages
- Disconnect users
- Verify notifications
- Check chat history
Server:
Alice joined the chat
Bob joined the chat
Alice: Hello Bob
[Private] Alice: Hi Bob
Bob left the chat
Client:
Alice: Hello everyone
[Private] Alice: Hi Bob
Chat log:
logs/chat_history.txt
The project was tested with:
| Test Case | Result |
|---|---|
| Server startup | โ PASS |
| Client connection | โ PASS |
| Multiple clients | โ PASS |
| Message broadcasting | โ PASS |
| Private messaging | โ PASS |
| User disconnect | โ PASS |
| Chat logging | โ PASS |
| Exception handling | โ PASS |
Complete project folder organization.
Multiple users communicating through Java socket server.
Stored messages generated by the application.
Testing communication between multiple users.
Testing user-to-user private communication.
This project demonstrates concepts used in:
- Messaging applications
- Multiplayer games
- Customer support systems
- Collaboration platforms
- Real-time notification systems
- Distributed applications
The same networking principles are used in large-scale backend systems.
Possible enhancements:
- Java Swing / JavaFX GUI
- User authentication
- Database integration
- Multiple chat rooms
- File sharing
- Message encryption
- Cloud deployment
- Online/offline status
- End-to-end encryption
Through this project, I learned:
โ
TCP/IP communication
โ
Socket programming
โ
Multithreaded server design
โ
Client-server architecture
โ
Real-time communication systems
โ
Network exception handling
โ
GitHub project management
java
socket-programming
tcp
networking
client-server
multithreading
threads
backend
java-project
console-application
oop
computer-networks
chat-application
server
github-portfolio
Muktai Vyawahare
Computer Science Engineering Student
GitHub Portfolio Project
If you like this project, consider giving it a โญ on GitHub.
Explore the implementation of Java networking, socket programming, and multithreaded backend systems.




