Last active
December 17, 2015 21:50
-
-
Save clowwindy/5677933 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 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(); | |
} |
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 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