In this assignment, you will learn how to open a TCP socket (and TCP endpoint) and develop a custom protocol
for performing file transfers.
What You Will Do:
1. Implement both a client and a server in C.
2. Establish a TCP connection between the client and server.
3. Design a custom protocol for requesting and transferring files.
Protocol Requirements:
• The client will send a request command to the server. Use a simple format, such as FETCH filename.
• The server will respond with:
• SUCCESS <file-size>: if the file is available, followed by the file contents.
• ERROR <reason>: if the file cannot be provided, with specific reasons like:
■ ERROR file_not_found
■ ERROR permission_denied
• The client will handle the server's response and save the file locally if the transfer is successful.
• File transfers should not extend beyond the server's local directory.
Deliverables:
1. Submit at least two C programs (server and client), along with any additional files (e.g., headers, makefiles).
2. Ensure your code compiles using the latest version of GCC on a Unix/Linux system.
3. Provide meaningful comments explaining the functionality of key sections in your code.
4. Demonstrate your code to your TA/professor, who will run test cases against it.