Results 1 to 2 of 2

Thread: QHttp help please

  1. #1
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QHttp help please

    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.

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QHttp help please

    Sorry guys.

    It works. Actually it was my mistake.

    Sorry once again.

    Admins if you want you can delete this thread.

Similar Threads

  1. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19
  2. QHttp related
    By whoops.slo in forum Qt Programming
    Replies: 12
    Last Post: 20th June 2006, 20:57
  3. QHttp has problems with some url's
    By whoops.slo in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2006, 23:16
  4. Help with QHttp needed.
    By bitChanger in forum Qt Programming
    Replies: 5
    Last Post: 25th January 2006, 21:09
  5. MultiThreading n Qhttp
    By Shambhavi in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2006, 13:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.