Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

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

Per capita income of winterfell is 15000 with a growth rate

Per capita income of Winterfell is $15,000 with a growth rate of 4%. Per capita income of King's Landing is $25,000 with a growth rate of 0%. How long until per capita income is the same in both locations?

Security risk assessment executive summarya detailed

SECURITY RISK ASSESSMENT Executive Summary A detailed Information security risk assessment was carried out on Fiji Directories Limited (FDL) during October 15th 2018 to October 24th 2018. FDL, an ATH group company, is a ...

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 ...

Prof gs farmer friend claims that aliens made crop circles

Prof G's farmer friend claims that aliens made crop circles in his farm. Using economic theory, prove his farmer friend wrong.

If a firms total cost function is given byt c

If a firm's total cost function is given byT C= 115,000Q-500Q2+Q3, what range of output does the firm have economies of scale?

Case study network design for ezy-booksezy-books is a

Case Study: Network Design for EZY-Books EZY-Books is a specialised publisher for customised book publication services based in Brisbane. The company has recently purchased a two-story building in a Brisbane suburb as it ...

Research assignmentproduce a formal 2000 word report in the

Research Assignment Produce a formal 2000 word report, in the format described in the supplied "Reports format and style" document, examining the various "Transition from IPv4 to IPv6". You are to research and compare th ...

It networking assignment - networking project areamajor lab

IT Networking Assignment - Networking Project Area Major Lab Scenario - Instructions This lab has a time limit of one term The lab must be completed by individual students, and the completed assessment returned to the as ...

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 ...

Below are the supply and demand schedules for fresh coffee

Below are the supply and demand schedules for fresh coffee in Vancouver: Price ($/cup) Quantity Demanded  (cups/day) Quantity Supplied (cups/day) 1 440 330 2 415 360 3 390 390 4 365 420 5 340 450 6 315 480 7 290 510 a. W ...

  • 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