Results 1 to 2 of 2

Thread: Reading from QNetworkReply working in another thread

  1. #1
    Join Date
    Nov 2006
    Location
    Poland
    Posts
    35
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11

    Question Reading from QNetworkReply working in another thread

    I send a QNetworkRequest from a QThread which creates a QNetworkReply there.
    Then I try to read() this reply from the main thread.

    Of course read()ing causes data removal from QNetworkReply's buffer.

    But it seems such reads collide with the thread writing incoming data into the QNetworkReply's buffer. This leads to buffer's data loss and even crashes (malloc() related).

    How can I solve this?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reading from QNetworkReply working in another thread

    Do it in one thread.

    Don't try and use networking across multiple threads. There's really no need for it.

Similar Threads

  1. Subclassing QNetworkReply
    By piotr.dobrogost in forum Qt Programming
    Replies: 6
    Last Post: 19th December 2010, 09:42
  2. Reading widgets from thread
    By sirlore in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2009, 22:58
  3. reading file with multi-thread
    By weixj2003ld in forum Qt Programming
    Replies: 10
    Last Post: 16th April 2009, 03:12
  4. IPC / reading stdin within non-GUI thread
    By mule in forum Qt Programming
    Replies: 3
    Last Post: 29th November 2007, 23:11
  5. GUI thread and Working thread comunication
    By FasTTo in forum Qt Programming
    Replies: 2
    Last Post: 13th September 2007, 16:31

Tags for this Thread

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.