A multi-client desktop chat application built with Java Socket Programming, Multithreading, and Java Swing.
The application allows multiple users to connect to a central server, chat with each other, view online users, and send private messages.
- 🔌 Client-Server communication
- 👥 Multiple users connected simultaneously
- 💬 Real-time group messaging
- 🔒 Private messaging between users
- 🟢 Online users list
- 🖥️ Java Swing graphical interface
- ⚡ Multithreading for multiple clients
- ⌨️ Enter key and SEND button support
- 📋 Built-in chat commands
- 🔄 Automatic online-user updates
| Technology | Purpose |
|---|---|
| Java | Core programming language |
| Java Swing | Desktop GUI |
| Socket / ServerSocket | Client-server networking |
| Multithreading | Handling multiple clients |
| BufferedReader | Reading messages |
| PrintWriter | Sending messages |
| ArrayList | Managing connected clients |
JavaChatApp/
│
├── src/
│ ├── client/
│ │ ├── ChatClient.java
│ │ └── ChatWindow.java
│ │
│ └── server/
│ ├── ChatServer.java
│ └── ClientHandler.java
│
├── out/
├── .gitignore
└── README.md
⚙️ How It Works
Client 1 ──┐
Client 2 ──┼──> Chat Server ──> Connected Clients
Client 3 ──┘
The ChatServer listens on port 5000.
Each connected client gets its own ClientHandler thread, allowing multiple users to communicate at the same time.
💬 Chat Commands
Command Description
/help Show available commands
/users Show online users
/msg username message Send a private message
/exit Leave the chat
Example:
/msg Deep Hello Deep!
▶️ Run the Project
1. Compile
From the JavaChatApp folder:
javac -d out src\server\ChatServer.java src\server\ClientHandler.java src\client\ChatClient.java src\client\ChatWindow.java
2. Start the Server
java -cp out server.ChatServer
The server runs on:
localhost:5000
3. Start Clients
Open another terminal and run:
java -cp out client.ChatClient
Start the command again in another terminal to connect another user.
For example:
Client 1 → Aditya
Client 2 → Deep
🧪 Example
ONLINE USERS
Aditya
Deep
Group chat:
Aditya: Hello Deep!
Deep: Hello Aditya!
Private chat:
/msg Deep This is a private message.
[Private] Aditya: This is a private message.
🚀 Future Improvements
🖱️ Click a user to start private chat
🔐 User authentication
🗄️ Database integration
🕒 Message timestamps
📎 File sharing
🔔 Desktop notifications
🌐 网络-based connections
🌍 Web version
🤖 AI Assistance
AI tools were used as a learning and development aid for understanding concepts, debugging, improving the GUI, and documentation.
The project was implemented, tested, and reviewed by me.
👨💻 Author
Aditya Singh
Java • Socket Programming • Multithreading • Swing • Client-Server Architecture
📌 Project Status
Core chat functionality completed.
Built as a college project to gain practical experience with Java networking, multithreading, GUI development, and client-server architecture.
This version is much better for GitHub because it gives someone the **important information without maki