• Try moving some data to see how much is being moved

    var n = 4, chk=5*1024;
    var tdata=new Uint8Array(chk);
    var i;
    for(i=0;i<1024;i++){
      tdata[i]=0x30;
      tdata[i+1024]=0x31;
      tdata[i+1024*2]=0x32;
      tdata[i+1024*3]=0x33;
      tdata[i+1024*4]=0x34;
    }//next i
    
    function onPageRequest(req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      var t=getTime();
      res.on('drain',function() {
      print("n=",n,"t:",(getTime()-t).toFixed(­3),"sec");
      if (n===0){ res.end();
       print("n=",n,"t:",(getTime()-t).toFixed(­3),"sec");
      }else {  
       res.write(E.toString(tdata));  
        n--;
       }//end else
      });//end opr
     }//end function
    
    IP=  192.168.1.9
    null
    Wi-Fi Connected
    n= 4 t: 0.008 sec
    n= 3 t: 1.092 sec
    n= 2 t: 2.859 sec
    n= 1 t: 4.056 sec
    n= 0 t: 5.809 sec
    n= 0 t: 5.811 sec
    n= 0 t: 0.008 sec
    n= 0 t: 0.009 sec
    

    Saved the page as test.txt and it contains 20 kB of data.


    1 Attachment

About