100% Guaranteed Results


Computer Networks Lab (CS 3272) Solved
$ 29.99
Category:

Description

5/5 – (1 vote)

Assignment – 7

A. Simple Web Server:

In this assignment, you will develop a simple Web server in C that is capable of processing only one HTTP request at a time. Specifically, your Web server will (i) create a TCP connection socket when contacted by a client (browser); (ii) receive the HTTP request from this connection; (iii) parse the request to determine the specific file being requested; (iv) get the requested file from the server’s file system; (v) create an HTTP response message consisting of the requested file preceded by header lines; and (vi) send the response over the TCP connection to the requesting browser. If a browser requests a file that is not present in your server, your server should return a “404 Not Found” error message.

B. Multi-threaded Web Server:

Currently, the web server handles only one HTTP request at a time. Now. implement a multithreaded server that is capable of serving multiple requests simultaneously. Using threading, first create a main thread in which your modified server listens for clients at a fixed port. When it receives a TCP connection request from a client, it will set up the TCP connection through another port and services the client request in a separate thread. There will be a separate TCP connection in a separate thread for each request/response pair.

Code for the Server:
A sample C code (WebServer.c) for the Web Server is given. Using this code as the reference, develop your own server and client programs (TCP socket program codes are shared) in C language and complete the given assignment.

Running the Web Server:
Put an HTML file (e.g., HelloWorld.html) in the same directory that the server is in. Run the server program. Determine the IP address of the host that is running the server (e.g., 128.238.251.26). From another host, open a browser and provide the corresponding URL. For example:

http://128.238.251.26:6789/HelloWorld.html

‘HelloWorld.html’ is the name of the file you have placed in the server directory. Note also the use of the port number after the colon. You need to replace this port number with whatever port you have used in the server code. In the reference code, the port number 6789 is used. The browser should then display the contents of HelloWorld.html. If you omit “:6789”, the browser will assume port 80 and you will get the web page from the server only if your server is listening at port 80.

Then try to get a file that is not present at the server. You should get a “404 Not Found” message.

Reviews

There are no reviews yet.

Be the first to review “Computer Networks Lab (CS 3272) Solved”

Your email address will not be published. Required fields are marked *

Related products