SlideShare a Scribd company logo
1 of 2
Download to read offline
Web Server Python Assignment
You will develop a web server that handles one HTTP request at a time. Your web server should
accept and parse the HTTP request, get the requested file from the servers file system, create an
HTTP response message consisting of the requested file, and then send the response directly to
the client. If the requested file is not present in the server, the server should send an HTTP 404
Not Found message back to the client.
HTML File
Create an HTML file and store this in the same directory as your server program. You can create
any HTML file you would like for this assignment, but it should at a minimum contain a body of
text.
Server code
Create the server socket (using TCP) and bind it to the IP address of the server and port
number.
Establish a listening socket to listen for incoming connections from a client.
Establish a separate connection socket for the client-server.
The server should then receive a request from the client. This message is the file name of
the HTML file that the client is requesting. The HTML file needs to be stored in the same
directory as the server script.
The server will need to extract the requested object from the message and open the file to
then read the contents of the requested file.
The server then sends an HTTP response (the status code) if the file is found and then
returns the contents of the file to the client.
The connection socket is then closed since we are only servicing one request per
connection.
The server should send the appropriate status code to the client if the file is not found and
close the connection socket.
* There is nothing in the code shutting down the server program if the connection is successful,
so make sure to kill the process manually when not working on the program. *
Client Code
Write your own HTTP client to test your server.
Your client will connect to the server using a TCP connection. You will need to accept
the IP address of the server and port number as input from the user.
Send a request to the server. This is a message containing the file path of the file the
client wants to retrieve. The file path is obtained as input from the user.
Display the server response and contents of the file as output. The client should be able to
receive all the bytes of data sent from the server regardless of the number of bytes of your
specific HTML file.
Close the connection

More Related Content

Similar to Web Server Python Assignment You will develop a web server that ha.pdf

4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptxZahouAmel1
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptxssuseraf60311
 
Hypertex transfer protocol
Hypertex transfer protocolHypertex transfer protocol
Hypertex transfer protocolwanangwa234
 
Web Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting StartedWeb Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting StartedPort80 Software
 
Web Server Technologies I: HTTP
Web Server Technologies I: HTTP Web Server Technologies I: HTTP
Web Server Technologies I: HTTP webhostingguy
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1hussulinux
 
Http request&response session 1 - by Vignesh.N
Http request&response session 1 - by Vignesh.NHttp request&response session 1 - by Vignesh.N
Http request&response session 1 - by Vignesh.NNavaneethan Naveen
 
Web Programming HTML.pptx
Web Programming HTML.pptxWeb Programming HTML.pptx
Web Programming HTML.pptxMarwaAnany1
 
Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Lori Head
 
1)Building a MultiThreaded Web ServerIn this lab we will devel
1)Building a MultiThreaded Web ServerIn this lab we will devel1)Building a MultiThreaded Web ServerIn this lab we will devel
1)Building a MultiThreaded Web ServerIn this lab we will develAgripinaBeaulieuyw
 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcaRenu Thakur
 

Similar to Web Server Python Assignment You will develop a web server that ha.pdf (20)

4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
 
Webbasics
WebbasicsWebbasics
Webbasics
 
Application layer
Application layerApplication layer
Application layer
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptx
 
Http
HttpHttp
Http
 
Appl layer
Appl layerAppl layer
Appl layer
 
Http_Protocol.pptx
Http_Protocol.pptxHttp_Protocol.pptx
Http_Protocol.pptx
 
Hypertex transfer protocol
Hypertex transfer protocolHypertex transfer protocol
Hypertex transfer protocol
 
www and http services
www and http serviceswww and http services
www and http services
 
Web Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting StartedWeb Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting Started
 
Web Server Technologies I: HTTP
Web Server Technologies I: HTTP Web Server Technologies I: HTTP
Web Server Technologies I: HTTP
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
 
Servlet & jsp
Servlet  &  jspServlet  &  jsp
Servlet & jsp
 
Http request&response session 1 - by Vignesh.N
Http request&response session 1 - by Vignesh.NHttp request&response session 1 - by Vignesh.N
Http request&response session 1 - by Vignesh.N
 
Web Programming HTML.pptx
Web Programming HTML.pptxWeb Programming HTML.pptx
Web Programming HTML.pptx
 
Http Introduction
Http IntroductionHttp Introduction
Http Introduction
 
Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207
 
Ch-1_.ppt
Ch-1_.pptCh-1_.ppt
Ch-1_.ppt
 
1)Building a MultiThreaded Web ServerIn this lab we will devel
1)Building a MultiThreaded Web ServerIn this lab we will devel1)Building a MultiThreaded Web ServerIn this lab we will devel
1)Building a MultiThreaded Web ServerIn this lab we will devel
 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mca
 

More from amirajsharma

What is a workflow a. Identify a process within your own business,.pdf
What is a workflow a. Identify a process within your own business,.pdfWhat is a workflow a. Identify a process within your own business,.pdf
What is a workflow a. Identify a process within your own business,.pdfamirajsharma
 
What are the two types of criminal prohibitions under the Economic E.pdf
What are the two types of criminal prohibitions under the Economic E.pdfWhat are the two types of criminal prohibitions under the Economic E.pdf
What are the two types of criminal prohibitions under the Economic E.pdfamirajsharma
 
What is a difference between base excision repair BER and nucleotide.pdf
What is a difference between base excision repair BER and nucleotide.pdfWhat is a difference between base excision repair BER and nucleotide.pdf
What is a difference between base excision repair BER and nucleotide.pdfamirajsharma
 
What are the current assets and current liabilitiesWhat are the d.pdf
What are the current assets and current liabilitiesWhat are the d.pdfWhat are the current assets and current liabilitiesWhat are the d.pdf
What are the current assets and current liabilitiesWhat are the d.pdfamirajsharma
 
What is a major possible negative feedback for the climate system.pdf
What is a major possible negative feedback for the climate system.pdfWhat is a major possible negative feedback for the climate system.pdf
What is a major possible negative feedback for the climate system.pdfamirajsharma
 
What is a conjugate prior Discuss the advantages and disadv.pdf
What is a conjugate prior Discuss the advantages and disadv.pdfWhat is a conjugate prior Discuss the advantages and disadv.pdf
What is a conjugate prior Discuss the advantages and disadv.pdfamirajsharma
 
What factors enable small business innovation.pdf
What factors enable small business innovation.pdfWhat factors enable small business innovation.pdf
What factors enable small business innovation.pdfamirajsharma
 
What early retirement options does a person in their early 60s in th.pdf
What early retirement options does a person in their early 60s in th.pdfWhat early retirement options does a person in their early 60s in th.pdf
What early retirement options does a person in their early 60s in th.pdfamirajsharma
 
What are the most important issues that an HR team needs to consider.pdf
What are the most important issues that an HR team needs to consider.pdfWhat are the most important issues that an HR team needs to consider.pdf
What are the most important issues that an HR team needs to consider.pdfamirajsharma
 
what if i di t have a partner - Create your own publicprivate keys.pdf
what if i di t have a partner  - Create your own publicprivate keys.pdfwhat if i di t have a partner  - Create your own publicprivate keys.pdf
what if i di t have a partner - Create your own publicprivate keys.pdfamirajsharma
 
What financial statement would you find the following Limited use.pdf
What financial statement would you find the following Limited use.pdfWhat financial statement would you find the following Limited use.pdf
What financial statement would you find the following Limited use.pdfamirajsharma
 
What does compile-time type checking do [6 marks] a. Allow a sing.pdf
What does compile-time type checking do [6 marks] a. Allow a sing.pdfWhat does compile-time type checking do [6 marks] a. Allow a sing.pdf
What does compile-time type checking do [6 marks] a. Allow a sing.pdfamirajsharma
 
What does HSAM stand forWhat is the range of memory.pdf
What does HSAM stand forWhat is the range of memory.pdfWhat does HSAM stand forWhat is the range of memory.pdf
What does HSAM stand forWhat is the range of memory.pdfamirajsharma
 
What enterprise application integration and Web services are How th.pdf
What enterprise application integration and Web services are How th.pdfWhat enterprise application integration and Web services are How th.pdf
What enterprise application integration and Web services are How th.pdfamirajsharma
 
What does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdf
What does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdfWhat does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdf
What does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdfamirajsharma
 
What could be the reason for a very faint colorimetric result in two.pdf
What could be the reason for a very faint colorimetric result in two.pdfWhat could be the reason for a very faint colorimetric result in two.pdf
What could be the reason for a very faint colorimetric result in two.pdfamirajsharma
 
What complication arises in degrees of freedom What distribution .pdf
What complication arises in degrees of freedom What distribution .pdfWhat complication arises in degrees of freedom What distribution .pdf
What complication arises in degrees of freedom What distribution .pdfamirajsharma
 
What are the implications of the authors findings How can this info.pdf
What are the implications of the authors findings How can this info.pdfWhat are the implications of the authors findings How can this info.pdf
What are the implications of the authors findings How can this info.pdfamirajsharma
 
What are the strongest arguments for considering fraternal twins wit.pdf
What are the strongest arguments for considering fraternal twins wit.pdfWhat are the strongest arguments for considering fraternal twins wit.pdf
What are the strongest arguments for considering fraternal twins wit.pdfamirajsharma
 
What are the arguments for and against giving money to the people of.pdf
What are the arguments for and against giving money to the people of.pdfWhat are the arguments for and against giving money to the people of.pdf
What are the arguments for and against giving money to the people of.pdfamirajsharma
 

More from amirajsharma (20)

What is a workflow a. Identify a process within your own business,.pdf
What is a workflow a. Identify a process within your own business,.pdfWhat is a workflow a. Identify a process within your own business,.pdf
What is a workflow a. Identify a process within your own business,.pdf
 
What are the two types of criminal prohibitions under the Economic E.pdf
What are the two types of criminal prohibitions under the Economic E.pdfWhat are the two types of criminal prohibitions under the Economic E.pdf
What are the two types of criminal prohibitions under the Economic E.pdf
 
What is a difference between base excision repair BER and nucleotide.pdf
What is a difference between base excision repair BER and nucleotide.pdfWhat is a difference between base excision repair BER and nucleotide.pdf
What is a difference between base excision repair BER and nucleotide.pdf
 
What are the current assets and current liabilitiesWhat are the d.pdf
What are the current assets and current liabilitiesWhat are the d.pdfWhat are the current assets and current liabilitiesWhat are the d.pdf
What are the current assets and current liabilitiesWhat are the d.pdf
 
What is a major possible negative feedback for the climate system.pdf
What is a major possible negative feedback for the climate system.pdfWhat is a major possible negative feedback for the climate system.pdf
What is a major possible negative feedback for the climate system.pdf
 
What is a conjugate prior Discuss the advantages and disadv.pdf
What is a conjugate prior Discuss the advantages and disadv.pdfWhat is a conjugate prior Discuss the advantages and disadv.pdf
What is a conjugate prior Discuss the advantages and disadv.pdf
 
What factors enable small business innovation.pdf
What factors enable small business innovation.pdfWhat factors enable small business innovation.pdf
What factors enable small business innovation.pdf
 
What early retirement options does a person in their early 60s in th.pdf
What early retirement options does a person in their early 60s in th.pdfWhat early retirement options does a person in their early 60s in th.pdf
What early retirement options does a person in their early 60s in th.pdf
 
What are the most important issues that an HR team needs to consider.pdf
What are the most important issues that an HR team needs to consider.pdfWhat are the most important issues that an HR team needs to consider.pdf
What are the most important issues that an HR team needs to consider.pdf
 
what if i di t have a partner - Create your own publicprivate keys.pdf
what if i di t have a partner  - Create your own publicprivate keys.pdfwhat if i di t have a partner  - Create your own publicprivate keys.pdf
what if i di t have a partner - Create your own publicprivate keys.pdf
 
What financial statement would you find the following Limited use.pdf
What financial statement would you find the following Limited use.pdfWhat financial statement would you find the following Limited use.pdf
What financial statement would you find the following Limited use.pdf
 
What does compile-time type checking do [6 marks] a. Allow a sing.pdf
What does compile-time type checking do [6 marks] a. Allow a sing.pdfWhat does compile-time type checking do [6 marks] a. Allow a sing.pdf
What does compile-time type checking do [6 marks] a. Allow a sing.pdf
 
What does HSAM stand forWhat is the range of memory.pdf
What does HSAM stand forWhat is the range of memory.pdfWhat does HSAM stand forWhat is the range of memory.pdf
What does HSAM stand forWhat is the range of memory.pdf
 
What enterprise application integration and Web services are How th.pdf
What enterprise application integration and Web services are How th.pdfWhat enterprise application integration and Web services are How th.pdf
What enterprise application integration and Web services are How th.pdf
 
What does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdf
What does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdfWhat does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdf
What does ln greater or equal to ft (LL-1 right) mean[lnft(L1L�rig.pdf
 
What could be the reason for a very faint colorimetric result in two.pdf
What could be the reason for a very faint colorimetric result in two.pdfWhat could be the reason for a very faint colorimetric result in two.pdf
What could be the reason for a very faint colorimetric result in two.pdf
 
What complication arises in degrees of freedom What distribution .pdf
What complication arises in degrees of freedom What distribution .pdfWhat complication arises in degrees of freedom What distribution .pdf
What complication arises in degrees of freedom What distribution .pdf
 
What are the implications of the authors findings How can this info.pdf
What are the implications of the authors findings How can this info.pdfWhat are the implications of the authors findings How can this info.pdf
What are the implications of the authors findings How can this info.pdf
 
What are the strongest arguments for considering fraternal twins wit.pdf
What are the strongest arguments for considering fraternal twins wit.pdfWhat are the strongest arguments for considering fraternal twins wit.pdf
What are the strongest arguments for considering fraternal twins wit.pdf
 
What are the arguments for and against giving money to the people of.pdf
What are the arguments for and against giving money to the people of.pdfWhat are the arguments for and against giving money to the people of.pdf
What are the arguments for and against giving money to the people of.pdf
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 

Web Server Python Assignment You will develop a web server that ha.pdf

  • 1. Web Server Python Assignment You will develop a web server that handles one HTTP request at a time. Your web server should accept and parse the HTTP request, get the requested file from the servers file system, create an HTTP response message consisting of the requested file, and then send the response directly to the client. If the requested file is not present in the server, the server should send an HTTP 404 Not Found message back to the client. HTML File Create an HTML file and store this in the same directory as your server program. You can create any HTML file you would like for this assignment, but it should at a minimum contain a body of text. Server code Create the server socket (using TCP) and bind it to the IP address of the server and port number. Establish a listening socket to listen for incoming connections from a client. Establish a separate connection socket for the client-server. The server should then receive a request from the client. This message is the file name of the HTML file that the client is requesting. The HTML file needs to be stored in the same directory as the server script. The server will need to extract the requested object from the message and open the file to then read the contents of the requested file. The server then sends an HTTP response (the status code) if the file is found and then returns the contents of the file to the client. The connection socket is then closed since we are only servicing one request per connection. The server should send the appropriate status code to the client if the file is not found and close the connection socket. * There is nothing in the code shutting down the server program if the connection is successful, so make sure to kill the process manually when not working on the program. * Client Code Write your own HTTP client to test your server. Your client will connect to the server using a TCP connection. You will need to accept the IP address of the server and port number as input from the user.
  • 2. Send a request to the server. This is a message containing the file path of the file the client wants to retrieve. The file path is obtained as input from the user. Display the server response and contents of the file as output. The client should be able to receive all the bytes of data sent from the server regardless of the number of bytes of your specific HTML file. Close the connection