Skip to content

Instantly share code, notes, and snippets.

@naneau
Created March 17, 2011 14:59
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 naneau/874462 to your computer and use it in GitHub Desktop.
Save naneau/874462 to your computer and use it in GitHub Desktop.
var host, http, port, server;
http = require('http');
host = '127.0.0.1';
port = 10000;
server = http.createServer(function(request, response) {
var body;
request.setEncoding('utf8');
body = '';
request.on('data', function(chunk) {
return body += chunk;
});
return request.on('end', function() {
console.log("Ping: " + body);
response.statusCode = 200;
return response.end('PONG');
});
});
server.listen(port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment