sorry for the mistake , the loop means 'for' loop.
 I give some code (Please correct me if I am mistaken)


app.get('/test', function(req, res){
   . .. ......
    for (var i = 0 ; i < resourceLinks.length   ; i++)
    {
       resourceURL = resourceLinks[i];
       Info(resourceURL , i );
    }
    console.log('End of Request ');
   ..............
 });

function Info(rURL, i )
{
      ..........................

       var options = {
       host:host,
       path: path,
       method :'GET'
     };

    var request =  http.request(options, function(resp) {
        ...........................

         resp.on('data', function (chunk) {
               console.log("Got response for request  " + i + " is .."
+ resp.statusCode);
         });

          ...........................
 });
 request.on('error', function(e) {
         console.log('problem with request: ' + e.message);
 }).end();
}



Here  call the function Info() for each resource and process the
request. In that function  print 'statusCode' for each request.
The result I got ..

    End of Request
    Got response for request 4 is .. 200
    Got response for request 7 is .. 200
    Got response for request 2 is .. 200
    Got response for request 1 is .. 200
    Got response for request 3 is .. 200
    .
    .
    .



  I need followings..

    *   need to print  'End of Request'  after processing all
requests. (ie i want to do something after all request
processing ) .How to know end of processing ?
    *   need to process 3 or 4 requests at the same time and get
responses continuously in the same order in which they are sent .
( Pipeline Implementation )

 If this requirements will not achieve by using above method please
tell good method .

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to