This is a simple real-time chat application built using Java with a server-client architecture. The project consists of two parts:
- Server Side: Handles incoming client connections and exchanges messages.
- Client Side: Connects to the server and participates in the chat.
- Real-time messaging between server and client.
- Simple GUI using Java's Swing framework.
- Message handling and display in both the client and server.
- Chat termination when either side sends the
"exit"command.
- Java JDK 8 or later.
- IntelliJ IDEA (or any other Java IDE).
- Basic knowledge of networking in Java.
src/: Contains the source code for the server and client applications.Server.java: Code for the server-side application.Client.java: Code for the client-side application.
git clone https://github.com/bhola-dev58/JLiveCharts.git cd JLiveCharts
- Open IntelliJ IDEA.
- Click on File > Open and select the folder where you cloned the project.
- Open
Server.javain the editor. - Run the Server class by clicking on the green play button or pressing
Shift + F10. - The server will be waiting for client connections.
- Open
Client.javain the editor. - Modify the IP address in the code to your server's IP (e.g.,
"localhost"or your network IP). - Run the Client class similarly by clicking the play button or pressing
Shift + F10.
- Once the client connects to the server, you can start typing messages in the text box.
- Press
Enterto send messages. - Type
"exit"to terminate the chat from either side, both from the GUI and from the terminal/bash.
- If running the chat from the terminal, simply type
"exit"and pressEnterto close the connection and exit the chat.
- Port Already in Use: Ensure the port
8080is free by checking if any other service is using it. - Firewall Blocking Connection: Allow Java through your firewall or disable the firewall temporarily.
- You can change the port by modifying the
ServerSocketinitialization in theServer.javafile. - To connect multiple clients, consider implementing multi-threading on the server-side.
