-
-
Save brettbuddin/376947 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conn = new Socket; | |
while (true) { | |
// listen on port 80 | |
if (conn.listen (8000)) { | |
// wait forever for a connection | |
var incoming; | |
while (incoming == null) { | |
incoming = conn.poll(); | |
} | |
// discard the request | |
conn.read(); | |
// Reply with a HTTP header | |
incoming.writeln ("HTTP/1.0 200 OK"); | |
incoming.writeln ("Content-Type: text/html"); | |
incoming.writeln(); | |
// Transmit a dummy homepage | |
incoming.writeln ("<html><body><h1>Homepage</h1></body></html>"); | |
// done! | |
incoming.close(); | |
delete incoming; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment