The goal of this project is to implement a server-client tcp connection where the backend (server) is set up in C and the frontend (GUI) is setup in Java (utilizing the Swing and AWT API). The file tcp_server.c contains the C code for the server which, in brief, creates a socket and waits for a client to connect. Once a client connects, it creates a thread which opens a new socket that opens and writes to a file. The socket serves as a way for the Java GUI (GetName.java and clientGUI.java) to connect to the server, and write to the file opened by the new socket fd which is binded to the client.
- Linux OS or virtual machine
- Java version 11
- Download tcp_server.c, clientGUI.java, and GetName.java in the same file directory.
- In the terminal, compile and run tcp_server.c code.
gcc tcp_server.c -lpthread -o server
sudo ./server
- In another terminal page, compile clientGUI.java and GetName.java and run clientGUI.java:
javac clientGUI.java GetName.java
java clientGUI
- The GUI will pop up. Enter a valid name and choose 1 of 3 themes:
Default Theme:
NightMode Theme:
Blue Theme:
- Optional: Open additional clients (max of 5 clients) by running clientGUI.java (see step 2).