Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

Develop a small web server that does the following:

•Handles only one HTTP request at a time;
•Accepts and parses the HTTP request;
•Gets the requested file from the server's file system;
•Creates an HTTP response message consisting of the requested file preceded by header lines;
•Sends the response directly to the requesting browser.

Below you will find the skeleton code for your Web server. The places where you need to fill in code are marked with #Fill in start and #Fill in end. Each place may require one or more lines of code.

#import socket module

from socket import * 

serverSocket = socket(AF_INET, SOCK_STREAM)

#Prepare a sever socket

#Fill in start


#Fill in end

while True:

#Establish the connection

print 'Ready to serve...'

connectionSocket, addr = # Fill in start #Fill in end 

try:

message = #Fill in start #Fill in end 

filename = message.split()[1] 

f = open(filename[1:]) 

outputdata = #Fill in start #Fill in end 

#Send one HTTP header line into socket

#Fill in start


#Fill in end 

#Send the content of the requested file to the client

for i in range(0, len(outputdata)): 

connectionSocket.send(outputdata[i])

connectionSocket.close()

except IOError:

#Send response message for file not found

#Fill in start

#Fill in end

#Close client socket

#Fill in start


#Fill in end 

serverSocket.close()

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M9645926
  • Price:- $90

Guranteed 48 Hours Delivery, In Price:- $90

Have any Question?


Related Questions in Computer Network & Security

Question suppose you wish encrypt the message beyonce using

Question : Suppose you wish encrypt the message BEYONCE using the one-time pad with the key RIHANNA (a) Encode to this message and the key as bits. (b) Encrypt with the one-time pad using XOR. What is the resulting ciphe ...

A wall street journal article noted that a study by us

A Wall Street Journal article noted that a study by U.S. Congressional Budget Office "estimated raising the minimum wage to $10.10 per hour reduced U.S employment by 500,000 but lift 900,000 Americans out of poverty". Wh ...

Assume that the number of customers who arrive at a water

Assume that the number of customers who arrive at a water ice stand follows the Poisson distribution with an average rate of 6.4 per 30 minutes. What is the probability that more than one customer will arrive during the ...

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

Consider the following series of paymentsyear 0 20year 1

Consider the following series of payments: Year 0: 20 Year 1: 30 Year 2: 40 Year 3: 10 Year 4: 5 Using an interest rate of 10%: a. What is the present value of this series of payments? b. What is the future value of this ...

A run in a setting is a substring of length at least two as

A run in a setting is a substring of length at least two, as long as possible, and consisting entirely of the same symbol. For instance, the string abbbaab contains a run of b's of length three and a run of a's of length ...

Income effects depend on the income elasticity of demand

Income effects depend on the income elasticity of demand for each good that you buy. If one of the goods you buy has a negative income elasticity, that is, it is an inferior good, what must be true of the income elastici ...

Design and implementation of secure enterprise wireless

Design and implementation of secure enterprise wireless network Purpose of the assessment  (with ULO Mapping) The purpose of this assignment is to design and implement a secure enterprise wireless network, considering th ...

With smaller companies saving thousands and larger

With smaller companies saving thousands and larger companies saving billions through flexible manufacturing, if you are a discrete parts manufacturer seeking to be more lean, it is important to consider whether this migh ...

Overviewthis assignment has three major aims- to help

Overview This assignment has three major aims: - To help students gain good understanding of theoretical and practical material. - To encourage students to use content analysis summaries to prepare for tests, examination ...

  • 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