Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The problem can be found below. I would like someone to run this. I dont get it because theres an error. Please, fix this because
The problem can be found below. I would like someone to run this. I dont get it because theres an error. Please, fix this because I dont know what is happening. What version of python should I use?
Please, if you dont know what is happening let someone else to do it.
Bp Project untitled PycharmProjects/untitled 3 import sys ServerPort 80 new server Socket socket (AF INET, S0CK STREAM) Illi External Libraries 6 #Prepare a sever socket 7 #Fill in start server Socket.bind server Port)) server Socket.listen (1) print the web server is up on port server Port 10 #Fill in end 11 while True: Establish the connection 13 print "Ready to serve... 14 connectionSocket add J server Socket. accept() 15 16 try: message connectionSocket.recv(1024) 17 print message message split 01, message. split 1] 18 filename 3 message. split [1] print filename 'II filename [1:] 20 open (filename (1:1) 21 output data f.read 22 print outputdata 23 Send one HTTP header line into socket Fill in start 25 connection Socket.send(' InHTTP/1.1 200 0KNnNn 26 connectionSocket.send(outputdata) 27 Fill in end 28 Send the content of the requested file to the client 29 for i in range (0, len(outputdata)): 30 connection Socket.send(outputdata [i]) 31 connection Socket.close 32 33 except IOError w Send response message for file not found 34 Fill in start 35 connectionSocket.send NnHTTP/1.1 404 Not Found nAn 36 connectionSocket.send 'InHTTP/1.1 404 Not Found n ') 37 38 39 /Library/Frameworks/Python, framework/Versions/2.7/bin/python2.7 /Users. File User S untitled new py", line 33 except IOError: SyntaxError: invalid syntax Process finished with exit code 1Step 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