Ask Computer Network & Security Expert

Part -1:

Develop a simple Web server in two steps. In the end, you will have built a Web server that is capable of processing simple web requests such as an HTML page with embedded images. You should be able to demonstrate that your Web server is capable of delivering a simple home page to a Web browser.

As you are developing the code, you can test your server from a Web browser. But remember that you are not serving through the standard port 80, so you need to specify the port number within the URL that you give to your browser. For example, if you are testing your program on toolman, your server is listening to port 5910, and you want to retrieve the file index.html, then you would specify the following URL within the browser

To simplify this programming task, you should develop the code in two stages. In the first stage, you will write part of the server that simply displays the contents of the HTTP request message that it receives. After this program is running properly, you will add the code required to generate an appropriate response.

Write a java program named HttpServer.java that opens a TCP socket at a user specified port to listen to HTTP GET requests. This should be relatively easy and similar to the TCP Socket programs that we wrote in class. Create a S that listens for incoming client requests at a specified port. When the server receives a request, obtain the input and output streams from the socket. Read the HTTP packet from the client as a set of strings, each of which is terminated by a line feed (\n). Once the packet is read, display the content to the screen.

How would you know that you are done reading the packet?

The last string should have length zero since it only has a carriage return (\r) and line feed (\n) character in it.

Part -2:

In this assignment, you will complete the web server that you started in the last assignment. At this point, your program should be able to analyze the HTTP packets sent by the browser. You will need to implement the HTTP GET method alone for completing the assignment. At the end of this assignment, your web server should be able to deliver a simple HTML web page with an embedded image.

Your program should parse the HTTP packet sent by the client to obtain the filename requested by the client. Look at the StringTokenizer java class to see how you can use it to parse the request line in the HTTP packet. You can ignore the header lines, since we are not interested in these in the assignment. In case if the file is not found, you should generate a response with status 404 Not found response. How can we generate this response? The HTTP response has three main parts - thes status line, header lines, and the Entity body. You would need to populate these values, and send these as a stream of bytes to the client. An example code snippet is given for your benefit.

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M91222433
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in Computer Network & Security

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

After reading this weeks materials please respond to two 2

After reading this week's materials, please respond to TWO (2) of the following questions. AND PROVIDE CITATION IN APA 1. Describe the differences between bus, ring, star and mesh topologies. 2. Explain the TCP/IP Model ...

The abstract should not be more than 250 words describe

The abstract should not be more than 250 words. Describe your project, focusing on research questions and research method for next stage of the project. 1. Introduction [The introduction should describe what the project ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As