Commit 04b9ac1d authored by Sorrel Harriet's avatar Sorrel Harriet
Browse files

simplifying very simple server

parent 82c89449
......@@ -11,14 +11,14 @@
import http.server
import socketserver
PORT = 8000 # specifies the port number to accept connections on
handler = http.server.SimpleHTTPRequestHandler # provides request handler
server_address = ("", PORT) # specify server directory and port number
server = http.server.HTTPServer # instantiates an HTTP server object
handler = http.server.SimpleHTTPRequestHandler # instantiates a request handler object
server_address = ("", PORT) # specifies server directory and port number
print("Starting server...") # outputs a message
httpd = socketserver.TCPServer(server_address, handler) # creates the server, passing it the server address and port number, as well as the CGI handler (httpd stands for HTTP Daemon)
httpd = server(server_address, handler) # creates the server which will listen at the HTTP socket, dispatching requests to the handler
print("serving at port", PORT) # outputs a message
httpd.serve_forever() # puts program in infinite loop so that the server can `serve_forever'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment