Authors:
This project implements a chat application that enables communication between computers using both UDP and TCP protocols. It consists of server and client components for UDP and TCP, as well as a graphical user interface for the client. For the UDP part, we have a single-directional communication. The TCP protocol is used to make a fully functional chat app. You can also use a graphical interface for the client side.
You can find the documentation here.
- Listens for UDP messages on a specified port (default: 8439).
- Sends UDP messages to the server on a specified host and port (default: localhost:8439).
- Listens for TCP connections on a specified port (default: 8439).
- Accepts multiple client connections and echoes messages to all clients.
- Connects to the TCP server on a specified host and port (default: localhost:8439).
- Allows user input through the console and sends it to the server. It can be used as a single thread-blocking mode (used in the terminal by default) or multi-thread to send and receive data asynchronously (used in graphical mode).
To compile the project, ensure you have Java installed and execute the following commands:
javac com/ensea_chatapp_udp/Server/UDPServer.java
javac com/ensea_chatapp_udp/Client/UDPClient.javajavac com/ensea_chatapp_tcp/Server/TCPServer.java
javac com/ensea_chatapp_tcp/Client/TCPClient.javajavac --module-path [javafx-dir]\javafx-sdk-21.0.1\lib --add-modules javafx.controls com/ensea_chatapp_gui/ChatApplication.javajava com.ensea_chatapp_udp.Server.UDPServer [port]java com.ensea_chatapp_udp.Client.UDPClient [host] [port]java com.ensea_chatapp_tcp.Server.TCPServer [port]java com.ensea_chatapp_tcp.Client.TCPClient [host] [port]java --module-path [javafx-dir]\javafx-sdk-21.0.1\lib --add-modules javafx.controls com.ensea_chatapp_gui.ChatApplication You can also use pre-compiled jar files to use functionalities.
java -jar Client_GUI.jar java -jar Server_GUI.jar java --module-path [javafx-dir]\javafx-sdk-21.0.1\lib --add-modules javafx.controls -jar Client_GUI.jar- Provides a graphical user interface for the TCP client.
- Allows users to connect to the server by specifying the address.
- Displays chat messages
- Allows users to input messages and send them to the server.
