A multithreaded client-server chat application built with Java Socket Programming.
This project demonstrates real-time communication where multiple clients can connect to a central server and exchange messages concurrently.
- Multithreaded Server: The server can handle multiple clients at the same time.
- Real-Time Chat: Enables simultaneous communication among all connected clients.
- Client-Server Architecture: Uses TCP communication through Java Sockets.
- Graphical User Interface: Provides a simple GUI for user interaction on the client side.
- Language: Java (JDK 1.8+)
- Concepts: Socket Programming, Multithreading, I/O Streams
- GUI: Swing / AWT
- Architecture: Client-Server with multiple client handlers
- Multi-client Support: Handle multiple clients simultaneously
- Real-time Messaging: Instant message broadcasting to all connected clients
- GUI Interface: User-friendly graphical interface for both server and client
- Multithreaded Architecture: Each client connection handled in separate threads
- Cross-platform Compatibility: Works on Windows and Linux
Server
|
┌─────────────────┼─────────────────┐
│ │ │
ClientHandler ClientHandler ClientHandler
Thread 1 Thread 2 Thread 3
│ │ │
Client1 Client2 Client3
The server accepts multiple client connections and creates a dedicated ClientHandler
thread for each client to manage message broadcasting.
- Java SE 8+ or later
- Java IDE (NetBeans, IntelliJ IDEA, or Eclipse) - optional but recommended
- JDK installed and configured
- MySQL installed and database created from
sql-queries.sql
-
Clone the repository:
git clone https://github.com/taher-dev/Chat-Application-JAVA.git cd java-chat-application
-
Open the project in your preferred Java IDE.
-
Compile the source code.
-
Run the Server: Execute the
Main.java
file first.File Location:
server\src\main\Main.java
The console will indicate that the server has started on port 9999.
-
Run the Client(s): Execute the
Main.java
file.File Location:
server\src\main\Main.java
You can run multiple instances of the client to simulate a group chat.
Chat-Application-JAVA/
├───Chat_Application
│ └───src
│ ├───app
│ ├───component
│ ├───emoji
│ │ └───icon
│ ├───event
│ ├───form
│ ├───images
│ ├───main
│ ├───model
│ ├───service
│ ├───swing
│ │ └───blurHash
│ └───themes
└───server
└───src
├───app
├───connection
├───main
├───model
├───service
└───swing
└───blurHash
Here’s what the application looks like in action:
Shows client connection notifications.
The initial login screen for the client application.
The main chat window where messages are exchanged between clients.
Chat View 1 | Chat View 2 |
---|---|
![]() |
![]() |
Avatar | Name | |
---|---|---|
![]() |
Taher Mahmud Monmoy | monmoyzx@gmail.com |
![]() |
Abdullah Sardar | abdullahalarafat147@gmail.com |
- This project was developed as part of the Computer Networking Lab (CSE 312) course at Green University of Bangladesh.
- A special thanks to our course teacher, Rusmita Halim Chaity, for her guidance.
Note: This project is for educational purposes and demonstrates fundamental concepts of socket programming and multithreading in Java.