Computer Science & Software Engineering |
CSCI 466 |
Code% python WebServer.py 1234 Ready to serve on port = 1234 New client: ('127.0.0.1', 50341) File requested: HelloWorld.html Bytes sent: 52 Ready to serve on port = 1234 New client: ('127.0.0.1', 50342) File requested: temp/HelloWorld2.html Bytes sent: 67 Ready to serve on port = 1234 New client: ('127.0.0.1', 50346) File requested: MissingFile.html File not found! Ready to serve on port = 1234 ... % python WebServer.py Ready to serve on port = 6789 ...
The last example has no output since this page is using "chunked" encoding for the body and so there is not Content-Length in the HTTP header.% python WebClient.py WebClient.py <server name> <server port> <page> % python WebClient.py localhost 6789 HelloWorld.html <html> <body> <h1>Hello world!</h1> </body> </html> % python WebClient.py cs.mtech.edu 80 index.html <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="http://cs.mtech.edu/main">here</a>.</p> <hr> <address>Apache/2.2.16 (Debian) Server at cs.mtech.edu Port 80</address> </body></html> % python WebClient.py cs.mtech.edu 80 main/
Page last updated: October 14, 2013