munna
12th September 2006, 07:29
Hi,
I want to post a few logs to a php script. Below is my code.
QString str;
QTime t, t1;
for(int i=0;i<noOfSeconds;i++){
t= QTime::currentTime();
t.addMSecs(1000);
for(int j=0;j<logsPerSecond;j++){
QString log = GenerateLog();
QHttpRequestHeader header( "POST", "someFile.php" ) ;
header.setValue( "Host", ipAddress ) ;
header.setContentType( "application/x-www-form-urlencoded" ) ;
http.request(header,QVariant(log).toByteArray());
}
t1 = QTime::currentTime();
while(t1 < t) {
t1= QTime::currentTime();
}
}
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.
I want to post a few logs to a php script. Below is my code.
QString str;
QTime t, t1;
for(int i=0;i<noOfSeconds;i++){
t= QTime::currentTime();
t.addMSecs(1000);
for(int j=0;j<logsPerSecond;j++){
QString log = GenerateLog();
QHttpRequestHeader header( "POST", "someFile.php" ) ;
header.setValue( "Host", ipAddress ) ;
header.setContentType( "application/x-www-form-urlencoded" ) ;
http.request(header,QVariant(log).toByteArray());
}
t1 = QTime::currentTime();
while(t1 < t) {
t1= QTime::currentTime();
}
}
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.