1*0e552da7Schristosvar net = require('net'); 2*0e552da7Schristos 3*0e552da7Schristosvar PHRASE = "hello world"; 4*0e552da7Schristosvar write = function(socket) { 5*0e552da7Schristos socket.write(PHRASE, 'utf8'); 6*0e552da7Schristos} 7*0e552da7Schristos 8*0e552da7Schristosfor (var i = 0; i < 1000; i++) { 9*0e552da7Schristos(function() { 10*0e552da7Schristos var socket = net.connect(7000, 'localhost', function() { 11*0e552da7Schristos socket.on('data', function(reply) { 12*0e552da7Schristos if (reply.toString().indexOf(PHRASE) != 0) 13*0e552da7Schristos console.error("Problem! '" + reply + "'" + " '" + PHRASE + "'"); 14*0e552da7Schristos else 15*0e552da7Schristos write(socket); 16*0e552da7Schristos }); 17*0e552da7Schristos write(socket); 18*0e552da7Schristos }); 19*0e552da7Schristos})(); 20*0e552da7Schristos} 21