Skip to content

Instantly share code, notes, and snippets.

@yeco
Created July 30, 2013 20:37
Show Gist options
  • Save yeco/6116676 to your computer and use it in GitHub Desktop.
Save yeco/6116676 to your computer and use it in GitHub Desktop.
var net = require('net');
var clients = [];
var server = net.createServer(function(sock){
sock.on('end', function(){
clients.splice(clients.indexOf(sock), 1);
});
clients.forEach(function(i){
sock.pipe(i).pipe(sock);
});
clients.push(sock);
});
server.listen(1337);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment