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
π Network-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