SlideShare a Scribd company logo
1 of 2
Download to read offline
Write in Python please
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.
What to turn in:
ReadMe
Server code
Client code
HTML file that you used to test your program

More Related Content

Similar to Write in Python please Web Server Python Assignment You will dev.pdf

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
 
Web Programming HTML.pptx
Web Programming HTML.pptxWeb Programming HTML.pptx
Web Programming HTML.pptxMarwaAnany1
 
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
 
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
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer ProtocolRajan Pandey
 
CSE422 Section 002 – Computer Networking Fall 2018 Ho.docx
CSE422 Section 002 – Computer Networking Fall 2018  Ho.docxCSE422 Section 002 – Computer Networking Fall 2018  Ho.docx
CSE422 Section 002 – Computer Networking Fall 2018 Ho.docxmydrynan
 
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
 

Similar to Write in Python please Web Server Python Assignment You will dev.pdf (20)

Appl layer
Appl layerAppl layer
Appl layer
 
Http
HttpHttp
Http
 
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
 
Http_Protocol.pptx
Http_Protocol.pptxHttp_Protocol.pptx
Http_Protocol.pptx
 
Hypertex transfer protocol
Hypertex transfer protocolHypertex transfer protocol
Hypertex transfer protocol
 
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
 
www and http services
www and http serviceswww and http services
www and http services
 
Servlet & jsp
Servlet  &  jspServlet  &  jsp
Servlet & jsp
 
Web Programming HTML.pptx
Web Programming HTML.pptxWeb Programming HTML.pptx
Web Programming HTML.pptx
 
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
 
PHP
PHPPHP
PHP
 
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
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
 
CSE422 Section 002 – Computer Networking Fall 2018 Ho.docx
CSE422 Section 002 – Computer Networking Fall 2018  Ho.docxCSE422 Section 002 – Computer Networking Fall 2018  Ho.docx
CSE422 Section 002 – Computer Networking Fall 2018 Ho.docx
 
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
 

More from albert20021

You observe that company A has just paid its most recent dividend D0.pdf
You observe that company A has just paid its most recent dividend D0.pdfYou observe that company A has just paid its most recent dividend D0.pdf
You observe that company A has just paid its most recent dividend D0.pdfalbert20021
 
You notice that, in western society, there is an association of hype.pdf
You notice that, in western society, there is an association of hype.pdfYou notice that, in western society, there is an association of hype.pdf
You notice that, in western society, there is an association of hype.pdfalbert20021
 
You have been hired as a social media consultant to develop social m.pdf
You have been hired as a social media consultant to develop social m.pdfYou have been hired as a social media consultant to develop social m.pdf
You have been hired as a social media consultant to develop social m.pdfalbert20021
 
You have been hired to design a database for the University of Mpuma.pdf
You have been hired to design a database for the University of Mpuma.pdfYou have been hired to design a database for the University of Mpuma.pdf
You have been hired to design a database for the University of Mpuma.pdfalbert20021
 
You have already implemented a lexical analyzer in Assignment #1 and.pdf
You have already implemented a lexical analyzer in Assignment #1 and.pdfYou have already implemented a lexical analyzer in Assignment #1 and.pdf
You have already implemented a lexical analyzer in Assignment #1 and.pdfalbert20021
 
You are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdf
You are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdfYou are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdf
You are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdfalbert20021
 
You decide to put your plan into Microsoft Project for easier manage.pdf
You decide to put your plan into Microsoft Project for easier manage.pdfYou decide to put your plan into Microsoft Project for easier manage.pdf
You decide to put your plan into Microsoft Project for easier manage.pdfalbert20021
 
you cross two individuals that are heterozygous at the R locus. if t.pdf
you cross two individuals that are heterozygous at the R locus. if t.pdfyou cross two individuals that are heterozygous at the R locus. if t.pdf
you cross two individuals that are heterozygous at the R locus. if t.pdfalbert20021
 
You are member of Chens care team. You do not speak Chinese. You fi.pdf
You are member of Chens care team. You do not speak Chinese. You fi.pdfYou are member of Chens care team. You do not speak Chinese. You fi.pdf
You are member of Chens care team. You do not speak Chinese. You fi.pdfalbert20021
 
You are given a phage lysate and a culture of bacterial cells. You a.pdf
You are given a phage lysate and a culture of bacterial cells. You a.pdfYou are given a phage lysate and a culture of bacterial cells. You a.pdf
You are given a phage lysate and a culture of bacterial cells. You a.pdfalbert20021
 
You are assessing a patient for syphilis. 1. What are some of the .pdf
You are assessing a patient for syphilis. 1. What are some of the .pdfYou are assessing a patient for syphilis. 1. What are some of the .pdf
You are assessing a patient for syphilis. 1. What are some of the .pdfalbert20021
 
You are a computer user. In your academic work, your engagement wit.pdf
You are a computer user.  In your academic work, your engagement wit.pdfYou are a computer user.  In your academic work, your engagement wit.pdf
You are a computer user. In your academic work, your engagement wit.pdfalbert20021
 
Write this in C language. This project will require students to si.pdf
Write this in C language. This project will require students to si.pdfWrite this in C language. This project will require students to si.pdf
Write this in C language. This project will require students to si.pdfalbert20021
 
Write one program with a menu allowing a user to select either an In.pdf
Write one program with a menu allowing a user to select either an In.pdfWrite one program with a menu allowing a user to select either an In.pdf
Write one program with a menu allowing a user to select either an In.pdfalbert20021
 
Write a statement that calls the function OutputAge. in coral code.pdf
Write a statement that calls the function OutputAge. in coral code.pdfWrite a statement that calls the function OutputAge. in coral code.pdf
Write a statement that calls the function OutputAge. in coral code.pdfalbert20021
 
Written Assignments 1. Complete a comparative report on concrete ver.pdf
Written Assignments 1. Complete a comparative report on concrete ver.pdfWritten Assignments 1. Complete a comparative report on concrete ver.pdf
Written Assignments 1. Complete a comparative report on concrete ver.pdfalbert20021
 
Write a MARIE program to allow the user to input 10 integers (positi.pdf
Write a MARIE program to allow the user to input 10 integers (positi.pdfWrite a MARIE program to allow the user to input 10 integers (positi.pdf
Write a MARIE program to allow the user to input 10 integers (positi.pdfalbert20021
 
Write SQL statements to answer the following queriesQ1 List of n.pdf
Write SQL statements to answer the following queriesQ1 List of n.pdfWrite SQL statements to answer the following queriesQ1 List of n.pdf
Write SQL statements to answer the following queriesQ1 List of n.pdfalbert20021
 
Write on the research statistics, surveillance baseline - identify a.pdf
Write on the research statistics, surveillance baseline - identify a.pdfWrite on the research statistics, surveillance baseline - identify a.pdf
Write on the research statistics, surveillance baseline - identify a.pdfalbert20021
 
Write a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdf
Write a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdfWrite a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdf
Write a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdfalbert20021
 

More from albert20021 (20)

You observe that company A has just paid its most recent dividend D0.pdf
You observe that company A has just paid its most recent dividend D0.pdfYou observe that company A has just paid its most recent dividend D0.pdf
You observe that company A has just paid its most recent dividend D0.pdf
 
You notice that, in western society, there is an association of hype.pdf
You notice that, in western society, there is an association of hype.pdfYou notice that, in western society, there is an association of hype.pdf
You notice that, in western society, there is an association of hype.pdf
 
You have been hired as a social media consultant to develop social m.pdf
You have been hired as a social media consultant to develop social m.pdfYou have been hired as a social media consultant to develop social m.pdf
You have been hired as a social media consultant to develop social m.pdf
 
You have been hired to design a database for the University of Mpuma.pdf
You have been hired to design a database for the University of Mpuma.pdfYou have been hired to design a database for the University of Mpuma.pdf
You have been hired to design a database for the University of Mpuma.pdf
 
You have already implemented a lexical analyzer in Assignment #1 and.pdf
You have already implemented a lexical analyzer in Assignment #1 and.pdfYou have already implemented a lexical analyzer in Assignment #1 and.pdf
You have already implemented a lexical analyzer in Assignment #1 and.pdf
 
You are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdf
You are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdfYou are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdf
You are given n observations X1, X2, . . . , Xn that are i.i.d. and .pdf
 
You decide to put your plan into Microsoft Project for easier manage.pdf
You decide to put your plan into Microsoft Project for easier manage.pdfYou decide to put your plan into Microsoft Project for easier manage.pdf
You decide to put your plan into Microsoft Project for easier manage.pdf
 
you cross two individuals that are heterozygous at the R locus. if t.pdf
you cross two individuals that are heterozygous at the R locus. if t.pdfyou cross two individuals that are heterozygous at the R locus. if t.pdf
you cross two individuals that are heterozygous at the R locus. if t.pdf
 
You are member of Chens care team. You do not speak Chinese. You fi.pdf
You are member of Chens care team. You do not speak Chinese. You fi.pdfYou are member of Chens care team. You do not speak Chinese. You fi.pdf
You are member of Chens care team. You do not speak Chinese. You fi.pdf
 
You are given a phage lysate and a culture of bacterial cells. You a.pdf
You are given a phage lysate and a culture of bacterial cells. You a.pdfYou are given a phage lysate and a culture of bacterial cells. You a.pdf
You are given a phage lysate and a culture of bacterial cells. You a.pdf
 
You are assessing a patient for syphilis. 1. What are some of the .pdf
You are assessing a patient for syphilis. 1. What are some of the .pdfYou are assessing a patient for syphilis. 1. What are some of the .pdf
You are assessing a patient for syphilis. 1. What are some of the .pdf
 
You are a computer user. In your academic work, your engagement wit.pdf
You are a computer user.  In your academic work, your engagement wit.pdfYou are a computer user.  In your academic work, your engagement wit.pdf
You are a computer user. In your academic work, your engagement wit.pdf
 
Write this in C language. This project will require students to si.pdf
Write this in C language. This project will require students to si.pdfWrite this in C language. This project will require students to si.pdf
Write this in C language. This project will require students to si.pdf
 
Write one program with a menu allowing a user to select either an In.pdf
Write one program with a menu allowing a user to select either an In.pdfWrite one program with a menu allowing a user to select either an In.pdf
Write one program with a menu allowing a user to select either an In.pdf
 
Write a statement that calls the function OutputAge. in coral code.pdf
Write a statement that calls the function OutputAge. in coral code.pdfWrite a statement that calls the function OutputAge. in coral code.pdf
Write a statement that calls the function OutputAge. in coral code.pdf
 
Written Assignments 1. Complete a comparative report on concrete ver.pdf
Written Assignments 1. Complete a comparative report on concrete ver.pdfWritten Assignments 1. Complete a comparative report on concrete ver.pdf
Written Assignments 1. Complete a comparative report on concrete ver.pdf
 
Write a MARIE program to allow the user to input 10 integers (positi.pdf
Write a MARIE program to allow the user to input 10 integers (positi.pdfWrite a MARIE program to allow the user to input 10 integers (positi.pdf
Write a MARIE program to allow the user to input 10 integers (positi.pdf
 
Write SQL statements to answer the following queriesQ1 List of n.pdf
Write SQL statements to answer the following queriesQ1 List of n.pdfWrite SQL statements to answer the following queriesQ1 List of n.pdf
Write SQL statements to answer the following queriesQ1 List of n.pdf
 
Write on the research statistics, surveillance baseline - identify a.pdf
Write on the research statistics, surveillance baseline - identify a.pdfWrite on the research statistics, surveillance baseline - identify a.pdf
Write on the research statistics, surveillance baseline - identify a.pdf
 
Write a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdf
Write a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdfWrite a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdf
Write a Recipe website Project Proposal (HTML,CSS)The Project Prop.pdf
 

Recently uploaded

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
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
 
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
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
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
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
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
 
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
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
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
 
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)
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

Write in Python please Web Server Python Assignment You will dev.pdf

  • 1. Write in Python please 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
  • 2. 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. What to turn in: ReadMe Server code Client code HTML file that you used to test your program