Results 1 to 2 of 2

Thread: How to stop network operation?

  1. #1
    Join Date
    Oct 2010
    Posts
    16
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Question How to stop network operation?

    Hi...
    I am sending a large file over a network by using QNetworkAccessmanager's post method
    Qt Code:
    1. QNetworkReply *reply = manager->post(request, postDataByteArray);
    To copy to clipboard, switch view to plain text mode 
    reply finished signal will be emitted once the entire post operation is complete. untle that networkaccessmanager keeps on sending the my large file.
    But my question is can i interrupt that post operation in middle if i want. I could not find any proper apis in networkaccessmanager's documentation to achieve that.
    Can some one suggest me how to solve this problem?

  2. #2
    Join Date
    Jul 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to stop network operation?

    QNetworkReply has a method abort(). However, at least with Qt 4.6 there is a bug, which make this unusable. I don't remember what exactly the problem was, but there was already a bug report. This is what I noted in my source code:
    Qt Code:
    1. // TODO/FIXME: This is a memory leak since the QNetworkReply might not be deleted.
    2. // However, there is a bug in Qt 4.6.3 and 4.7.0 which results frequently in a segfault
    3. // when calling abort or trying to delete the reply before it signals finished on its own.
    4. m_queryReply = NULL;
    To copy to clipboard, switch view to plain text mode 
    So my "solution" for this is just to ignore the reply result if it should arrive later.

    The bug report said the problem would be fixed in 4.7.x However, I did not tried yet with 4.7.1.
    Beware of bugs in the above code; I have only proved it correct, not tried it. (Donald Knuth)

Similar Threads

  1. Print Operation for tableWidget
    By jaya in forum Qt Programming
    Replies: 0
    Last Post: 5th October 2010, 07:55
  2. Opposite of |= operation
    By JPNaude in forum Qt Programming
    Replies: 5
    Last Post: 16th November 2009, 12:33
  3. file operation
    By jay in forum Qt Programming
    Replies: 3
    Last Post: 7th May 2009, 11:19
  4. setting Cursor for one operation
    By keshab in forum Newbie
    Replies: 1
    Last Post: 22nd December 2006, 08:09
  5. Problem in Cut Operation
    By ankurjain in forum Qt Programming
    Replies: 4
    Last Post: 14th April 2006, 12:23

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.