Synchronous http request in node.js, that you dont want, probably

Achtung dummy code!

…and so it goes Asynchronous:

for(var i = 0; i < loop.length; i++)
{
var proxy = http.createClient(PORT,SERVER);
var request = proxy.request('GET', url, 
{
"host": SERVER
});
request.end();
...
}

fire, fire, fire, fire

… and so it dont, Synchronous then:

var proxy = http.createClient(PORT,SERVER);
for(var i = 0; i < loop.length; i++)
{
var request = proxy.request('GET', url, 
{
"host": SERVER
});
request.end();
...
}

point – shoot, point – shoot, point – shoot

well i didnt know that :)

Leave a Reply

Your email address will not be published. Required fields are marked *