Skip to content

Instantly share code, notes, and snippets.

@cashlo
Created October 25, 2011 08:32
Show Gist options
  • Save cashlo/1311851 to your computer and use it in GitHub Desktop.
Save cashlo/1311851 to your computer and use it in GitHub Desktop.
var mySockets = [];
var server = net.createServer(function (socket) {
socket.write("Echo server\r\n");
mySockets.push(socket);
socket.on('data',function(data){
mySockets.forEach(function(s){
s.write(data);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment