Skip to content

Instantly share code, notes, and snippets.

@jcarroyo
Created January 24, 2016 17:54
Show Gist options
  • Save jcarroyo/5886044cdd64245aa53f to your computer and use it in GitHub Desktop.
Save jcarroyo/5886044cdd64245aa53f to your computer and use it in GitHub Desktop.
Very simple echo server in Node.js
var net = require('net');
var server = net.createServer(function(socket){
socket.on('data', function(data){
console.log('data received', data.toString());
socket.write(data, function(){
console.log("data re-sended");
})
});
}).listen(9090);
server.on('listening', function(){
console.log('server is listening');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment