Created
February 10, 2010 02:27
-
-
Save rmax/299954 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 tcp = require('tcp'); | |
var sys = require('sys'); | |
var count = 0; | |
var connected_callback = function(conn, name) { | |
return function() { | |
count++; | |
sys.debug("Connected " + name); | |
conn.send("GET / HTTP/1.1\r\n"); | |
conn.readPause(); | |
sys.debug("Open Connections " + count); | |
}; | |
}; | |
var closed_callback = function(conn, name) { | |
return function() { | |
//sys.debug("Closed " + name); | |
}; | |
}; | |
for (var i=0; i < 10000; ++i) { | |
var connection = tcp.createConnection(80, 'localhost'); | |
connection.addListener('connect', connected_callback(connection, i)) | |
.addListener('close', closed_callback(connection, i)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment