Results 1 to 2 of 2

Thread: MultiThreading n Qhttp

  1. #1
    Join Date
    Jan 2006
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default MultiThreading n Qhttp

    I am trying to simulate an environment where 'n' systems are simultaneously, sending 'x' requests each, to a server in my program

    I am using Qhttp to send the 'x' requests to the server. This part is working fine perfectly.

    Now in order to simulate 'n' systems sending these requests simultaneously I am using multithreading.

    In main i have this
    Qt Code:
    1. for(int i=0;i<noOfThreads;i++)
    2. {
    3. MyThread t(noOfLogs);
    4. t.start();
    5. }
    To copy to clipboard, switch view to plain text mode 

    and I have reimplemented run() of MyThread class to send the x requests.

    The program is however crashing, where am I going wrong?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    85
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: MultiThreading n Qhttp

    t is a local variable which is constructed at the beginning of the loop body and destroyed at the end of the body. Use a QList<MyThread*> to store the pointers you created in the loop with new.

Similar Threads

  1. problem in using QHttp
    By Ferdous in forum Newbie
    Replies: 4
    Last Post: 10th September 2008, 13:07
  2. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 11:41
  3. QHttp with localhost.
    By William Wilson in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2007, 21:26
  4. QHttp download file problem.
    By fengtian.we in forum Qt Programming
    Replies: 12
    Last Post: 12th June 2007, 10:39
  5. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 12:19

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.