This is a simple server-client implementation using TCP. The project includes functionality for sending messages, files, and even some fun options! Note that only one client is allowed to connect to the server at a time.
This project is designed to run on macOS Sonoma 14.6.1. Compatibility with other macOS versions or operating systems is not guaranteed.
This project requires the following external libraries:
-
OpenSSL
- Used for secure connections between the server and client.
- Installation:
brew install openssl
- Ensure OpenSSL is linked correctly:
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
-
PortAudio
- Used for audio processing and playback.
- Installation:
brew install portaudio
-
mpg123
- Used for decoding MP3 files for audio playback.
- Installation:
brew install mpg123
-
Standard C Libraries
- Used for basic input/output and networking (
<stdio.h>
,<stdlib.h>
,<string.h>
,<arpa/inet.h>
,<unistd.h>
).
- Used for basic input/output and networking (
Ensure these libraries are properly installed before running the project.
This implementation includes the following features:
- Sending and receiving messages between the client and server.
- Sending messages to other clients.
- Registering and logging in users.
- Sending files to other clients.
- Receiving files from other clients.
- Fun and interactive options, including audio playback with PortAudio and mpg123.
- Encrypted message transfer.
- Beautiful and colorful client terminal interface.
Follow these steps to compile and run the server and client:
-
Compile the Server and Client Use the provided
Makefile
to compile both the server and client programs:make
-
Start the Server
./server [port_number]
-
Start the Client We support up to 10 clients for a single server.
./client [port_number]
-
Example
./server 8080 ./client 8080
If the makefile can't run properly on your machine, you can directly use the executable file "server" and "client" in the code directory to run the program.
- Enter your username and password to log in.
- If the credentials are correct, you will gain access to the system's features.
- If the credentials are incorrect, the server will notify you.
- Create a new account by providing a unique username and password.
- The server will confirm successful registration.
- If the username is already in use, you will be asked to try another one.
- Exit the application gracefully.
- Type a message, and it will be sent directly to the server.
- The server will respond with a confirmation message.
- Enter the recipient's username and the message you wish to send.
- If the user is valid, the message will be delivered.
- View messages that have been sent to you by other users.
- The server will list the messages with the sender's username.
- Provide the filename and the recipient's username.
- The file will be securely transferred to the specified user.
- View and download files that other users have sent to you.
- The file will be saved in your local directory.
- Relax and enjoy a fun audio feature as a small Easter egg. 🐻🎶
- Exit the application gracefully.