--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I have found the solution by overwriting the default global agent. One possibility is to setmaxSockets:1
:
var http = require( "http"),
agent = new http.Agent( {maxSockets: 1} ); // <-- this is new
function httpRequest( callback ) {
var options = {
host: 'localhost',
port: 80,
path: '',
agent: agent // <-- and this is new
},
...
With this correction the example above works. But I still had the EADDRNOTAVAIL issue within my production code, so setting the agent
to false
did it finally:
var http = require( "http");
function httpRequest( callback ) {
var options = {
host: 'localhost',
port: 80,
path: '',
agent: false // <-- here
},
...