Created
March 25, 2012 04:47
-
-
Save edsu/2191407 to your computer and use it in GitHub Desktop.
demonstrating a Parse Error
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
/* | |
* This script demonstrates an exception that gets thrown when a certain number of | |
* concurrent requests are made of the hdl.loc.gov server with node v0.6.12 | |
* and the maxSockets is set below the number of concurrent requests that are | |
* made. | |
*/ | |
var http = require('http'); | |
// if you lower this below 10 you will get a Parse Error on one | |
// of the requests in the loop below | |
http.globalAgent.maxSockets = 10; | |
for (i=0; i<=9; i++) { | |
var opts = {host: 'hdl.loc.gov', path: '/loc.music/eadmus.mu009007.2'} | |
http.get(opts, function (res) { | |
console.log(res.statusCode); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment