Created
July 30, 2013 20:37
-
-
Save yeco/6116676 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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