Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ Java Chat Application

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.

✨ Features

  • πŸ”Œ 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

πŸ› οΈ Technologies Used

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

πŸ“ Project Structure

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

About

A multi-client Java chat application using Socket Programming, Multithreading and Swing GUI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages