Hi,

I want to post a few logs to a php script. Below is my code.

Qt Code:
  1. QString str;
  2. QTime t, t1;
  3. for(int i=0;i<noOfSeconds;i++){
  4. t= QTime::currentTime();
  5. t.addMSecs(1000);
  6. for(int j=0;j<logsPerSecond;j++){
  7. QString log = GenerateLog();
  8. QHttpRequestHeader header( "POST", "someFile.php" ) ;
  9. header.setValue( "Host", ipAddress ) ;
  10. header.setContentType( "application/x-www-form-urlencoded" ) ;
  11. http.request(header,QVariant(log).toByteArray());
  12. }
  13. t1 = QTime::currentTime();
  14. while(t1 < t) {
  15. t1= QTime::currentTime();
  16. }
  17. }
To copy to clipboard, switch view to plain text mode 

Is the above code correct ? Can I call request() in a loop and will it be queued ?

I tried it with an example where both the loops are called for 5 times but the logs are posted only once.

Please help
Thanks a lot.