This project consists of implementing a client-server socket program in C with various designs and features. The aim is to explore different server designs and observe their performance metrics. Below is an overview of the project's features:
- Each part of the project has corresponding folder (eg. fork for fork- based server, non_block folder has 3 nested folders)
- Navigate to each folder to run the code, using following steps
make
to compile server and client filesmake run_server
to run the server codemake run_client
to run the client code (do it in separate terminal)make clean
to remove binaries and text output
-
Sequential Server: Opens a new file upon the first client connection. For each client request, it computes the factorial of the received number, stores the result along with the client's ID in the file, and sends the result back to the client. The file is closed when all client connections are closed.
-
Concurrent Server with Multiple Processes: Utilizes the
fork
system call to create multiple processes for concurrent handling of client requests. -
Concurrent Server with Multiple Threads: Uses the
pthreads
library to create multiple threads for concurrent handling of client requests. -
Non-blocking Server: Capable of managing a maximum of 10 clients using different system calls:
- Using select(): Implements non-blocking I/O operations using the
select()
system call. - Using poll(): Implements non-blocking I/O operations using the
poll()
system call. - Using epoll API: Utilizes the epoll API for efficient event-driven I/O operations.
- Using select(): Implements non-blocking I/O operations using the
-
For each server design (except 2a), the server concurrently processes 10 client requests. This allows running 10 concurrent client programs.
-
The following metrics are observed: