Skip to content

Instantly share code, notes, and snippets.

@smith
Created November 1, 2010 18:02
Show Gist options
  • Save smith/658613 to your computer and use it in GitHub Desktop.
Save smith/658613 to your computer and use it in GitHub Desktop.
var net = require("net");
function echoServer (stream) {
stream.setEncoding("utf8");
stream.on("connect", function () {
console.log("-- someone connected to the Node.js echo server!");
});
stream.on("data", function (data) {
stream.write(">>>you sent: " + data);
});
}
net.createServer(echoServer).listen(8082, "0.0.0.0");
console.log("Running Node.js echo server on 8082");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment