Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
data-networks-web
lab-exercises
Commits
2d22f526
Commit
2d22f526
authored
Nov 10, 2017
by
Sorrel Harriet
Browse files
Merge branch 'master' of gitlab.doc.gold.ac.uk:data-networks-web/lab-exercises
parents
15d527c6
fd88bc0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
lab-5/verySimpleServer.py
View file @
2d22f526
...
...
@@ -3,20 +3,20 @@
""" A Very Simple Web Server
Run with ./verySimpleServer.py
Make sure all
cgi
scripts are executable
for single script:
chmod +x
script
.py
Make sure all scripts are executable
e.g.
for single script:
chmod +x
verySimpleServer
.py
or for a whole directory:
chmod -r +x htdocs/
"""
import
http.server
PORT
=
8000
# specifies the port number to accept connections on
PORT
=
8000
# specifies the port number to accept connections on
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
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
=
server
(
server_address
,
handler
)
# creates the server which will listen at the HTTP socket, dispatching requests to the handler
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment