Skip to content

Instantly share code, notes, and snippets.

@clowwindy
Last active December 17, 2015 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clowwindy/5677933 to your computer and use it in GitHub Desktop.
Save clowwindy/5677933 to your computer and use it in GitHub Desktop.
var net = require('net');
var data = Array(1024).join(' ');
function go() {
var s = null;
s = net.connect(8000, '127.0.0.1', function() {
setInterval(function() {
console.log(s.write(data));
}, 1000);
});
};
var i;
for (i = 0; i<2000; i++) {
go();
}
var net = require('net');
var i = 0;
var server = net.createServer(function (s) {
s.write("welcome!\n");
console.log('got client',++i);
// uncomment this!
// s.on('data',function(){});
})
server.listen(8000);
console.log('127.0.0.1:8000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment