Question: 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
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 \
r
Then, your program should read the entire result and display it on the screen.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
