Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Three lines of code, lines numbered 13, 18, and 23 are missing in the lab3.pdf program and are marked in green as comments. Complete the
Three lines of code, lines numbered 13, 18, and 23 are missing in the lab3.pdf program and are marked in green as comments. Complete the code and verify that it executes.
Use the following command to compile
c\>python lab3.p
Send a screenshot of the set of commands used to execute your program, and a screenshot of the output.
# Import socket module from socket import * serverSocket = socket (AF_INET, SOCK_STREAM) server Port = 6789 serverSocket.bind(("", serversort)) serverSocket.listen (1) # Server should be up and running and listening to the incoming connections while True : print ('Ready to serve...') # Set up a new connection from the client # fillin 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 # If an exception occurs during the execution of try clause try: # Receives the request message from the client # fillin filename = message.split() [1] f = open(filename[1:]) outputdata f.read() # Send the HTTP response header line to the connection socket # fillin = for i in range (0, len (outputdata)): connectionsocket.send(outputdata[i]) connection socket.send(" ") connectionSocket.close() except IOError: connectionsocket.send("HTTP/1.1 404 Not Found ") connectionsocket.send("
404 Not Found
") connection socket.close() 34 35 36 37 38 serverSocket.close()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started