A high-performance, multithreaded client-server application built with Java and JavaFX. This project facilitates real-time, bidirectional messaging across a local network, featuring a modern GUI and robust concurrency management.
This application demonstrates the implementation of a raw TCP/IP communication protocol without relying on high-level messaging libraries. It handles multiple concurrent client connections via a threaded server architecture, ensuring non-blocking communication and UI responsiveness.
- Real-Time Communication: Instant bidirectional messaging between multiple users using Java Sockets.
- Multithreaded Server: Handles multiple client connections simultaneously using
Java ThreadsandRunnableinterfaces. - Modern UI: A responsive JavaFX interface styled with CSS, featuring:
- Scrollable chat history.
- WhatsApp-style message bubbles.
- Dynamic "Active Users" sidebar.
- Live System Events: Broadcasts "User Joined" and "User Left" updates to all connected clients in real-time.
- Client-Server Model: The Server listens on a specific port and spawns a new
ClientHandlerthread for every incoming connection. - Thread Safety: Solved concurrency challenges by using
Platform.runLater()to marshal background network events back onto the main JavaFX Application Thread, preventing UI freezing or threading exceptions. - Synchronization: Implemented synchronized blocks to safely manage the list of active clients and broadcast messages without data races.
- Language: Java (JDK 17+)
- GUI: JavaFX, FXML, CSS
- Networking:
java.net.Socket,java.net.ServerSocket - I/O:
BufferedReader,PrintWriter
| Login Screen | Chat Interface |
|---|---|
![]() |
![]() |
- Start the Server:
- Run
ServerLauncher.java. - The server will start listening for connections.
- Run
- Start Clients:
- Run
ClientLauncher.java. - Enter a username and connect.
- You can run multiple instances of the Client to simulate a group chat.
- Run
This project is open source and available for educational purposes.

