Question: having trouble with running the code on python. I get a bunch of errors. I am trying to run code importing socket to webserver I

having trouble with running the code on python. I get a bunch of errors. I am trying to run code importing socket to webserver I have the html file. I will attach my code. please helphaving trouble with running the code on python. I get a bunch

#import socket module from socket import* import sys # In order to terminate the program serverSocketsocket (AF INET, SOCK STREAM) #Prepare a sever socket #Fill in start serverPort12000 serverSocket.bind ( ('", serverPort)) serverSocket.listen (1) #Fill in end while True: print ('Ready to serve...') connectionSocket, addr - serverSocket.accept () try: message-connectionSocket.recv (1024) .decode () filename-message.split ) [1] f = open (filename [1: ] ) outputdata -f.read () connectionSocket . send (bytes ( ' HTTP/ 1 . x 200 connectionSocket.send (" ".encode ()) OK ' , ' UTF-8" ) ) for i in range (0, len (outputdata)): connectionSocket.send (outputdata[i].encode ()) connectionSocket.send (" " .encode ()) connectionSocket.close () except TOError: connectionSocket.send ('n404 File Not Found '.encode ()) connectoinSocket.close () serverSocket.close () sys .extit()#Terminate the program after sending the corresponding data

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!