A desktop-based client-server chat application built using Java Socket Programming. The project demonstrates TCP/IP communication between a single client and a single server with a simple Swing-based graphical interface.
- Real-time messaging between a client and a server.
- TCP/IP communication using Java Sockets.
- Concurrent message handling using a dedicated thread for receiving messages.
- Desktop GUI built with Java Swing.
- Graceful connection termination using the
endcommand.
- Java
- Socket Programming (TCP/IP)
- Java Swing
- Multithreading
- BufferedReader & PrintWriter
- Start the server application.
- The server waits for a client connection on port 7777.
- Start the client application.
- Once connected, both users can exchange messages through the GUI.
- Typing end closes the connection.
.
├── Client.java
├── Server.java
└── ChatLogo.png
- Client-Server Architecture
- TCP Socket Programming
- Concurrent Message Handling using Threads
- Java Swing GUI
- Event Handling
- Object-Oriented Programming
javac Server.java
javac Client.javajava Serverjava ClientThe client will connect to the server running on localhost:7777.
- Supports only one client at a time.
- Messages are exchanged only between one client and one server.
- No user authentication.
- No chat history or message persistence.
- Works only over a local network unless the IP address and port are configured appropriately.
- Support multiple clients simultaneously.
- Add usernames and user authentication.
- Encrypt communication using SSL/TLS.
- Store chat history in a database.
- Implement file sharing.
- Add emojis and timestamps.
- Improve the user interface.
This project helped me understand:
- Java Socket Programming
- TCP/IP communication
- Thread-based concurrent message handling
- Java Swing event handling
- Client-server architecture
- Integrating networking logic with a desktop GUI
The core networking and multithreading logic for this project was implemented by me. The Swing GUI layout was created with the assistance of AI and integrated with the networking code.