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