Question: Requirement: Must use csapp.c and csapp.h which implements function wrappers that greatly simplify the question. Part A Using network sockets, write a C program called
Requirement: Must use "csapp.c" and "csapp.h" which implements function wrappers that greatly simplify the question.
Part A
Using network sockets, write a C program called client that receives three command-line arguments in the form:
client host port file
and sends a request to a web server. The command-line arguments are host Represents the web server to connect to
port Represents the port number where a request is sent. Normally an HTTP request is sent over port 80, but this format allows for custom ports
file Represents the file requested from the web server. Your program should create a client socket that connects to the server indicated by host,
and send the following:
GET /index.html HTTP/1.1 Host: www.google.com
Then, your program should read the entire result and display it on the screen.
Part B
Write a second program that accepts a port number as a command line argument, and starts an HTTP server. This server should constantly accept() connections, read requests of the form
GET /path HTTP/1.1
read the file indicated by /path, and send it over the connect file descriptor returned by the call to accept().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
