A simple TCP server implemented in C that handles basic GET and PUT commands from clients. The server can handle multiple client connections using the fork() system call for concurrent processing.
- Process Management: Utilizes
fork()to handle multiple clients concurrently. - Socket Programming: Demonstrates basic TCP socket operations.
- GET and PUT Operations: Supports GET to read and send file contents to the client, and PUT to receive and write data from the client to a file.
- Error Handling: Provides appropriate error messages for various failure scenarios.
- Language: C
- Libraries: Standard C libraries, Socket programming
- System Calls:
fork(),socket(),bind(),listen(),accept(),recv(),send(),fopen(),fgetc(),fwrite()
- Clone the repository.
- Compile the
tcp_server.cfile using a C compiler.
gcc -o tcp_server tcp_server.c- Run the compiled executable providing the port number as a command-line argument.
./tcp_server <port_number>Replace <port_number> with the desired port number (must be greater than 1024).
These implementations were created for a NWEN241 assignment at Victoria University of Wellington.