Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@edsu
Created March 25, 2012 04:47
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 edsu/2191407 to your computer and use it in GitHub Desktop.
Save edsu/2191407 to your computer and use it in GitHub Desktop.
demonstrating a Parse Error
/*
* 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