Skip to content

Instantly share code, notes, and snippets.

@cmlenz
Created December 4, 2009 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmlenz/249378 to your computer and use it in GitHub Desktop.
Save cmlenz/249378 to your computer and use it in GitHub Desktop.
var http = require("http"),
sys = require("sys");
var server = http.createServer(function(request, response) {
response.sendHeader(200, {"Content-Length": "42"});
response.finish();
sys.puts("Server finished response");
}).listen(8000);
var client = http.createClient(8000, "localhost");
var req = client.request("HEAD", "/");
req.finish(function(resp) {
sys.puts("Client listening for completion event");
resp.addListener("complete", function() {
// This never gets called right now
sys.puts("Completion event fired!");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment