Skip to content

Instantly share code, notes, and snippets.

@sidorares
Created July 15, 2011 05:00
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 sidorares/1084101 to your computer and use it in GitHub Desktop.
Save sidorares/1084101 to your computer and use it in GitHub Desktop.
tcp ping-pong benchmark
var net = require('net');
var s = net.createServer(function(c) {
c.write(' ');
c.on('data', function(buf) {
c.write(' ');
});
}).listen(1235);
var counter = 0;
var cc = net.createConnection(1235);
cc.on('data', function(buf) {
cc.write(' ');
counter++;
});
setInterval(function() {
console.log(counter);
counter = 0;
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment