Skip to content

Instantly share code, notes, and snippets.

@hairgamiMaster
Created April 23, 2010 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hairgamiMaster/376943 to your computer and use it in GitHub Desktop.
Save hairgamiMaster/376943 to your computer and use it in GitHub Desktop.
conn = new Socket;
// listen on port 80
if (conn.listen (8000)) {
// wait forever for a connection
var incoming;
do {
incoming = conn.poll();
}
while (incoming == null);
// 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