Results 1 to 2 of 2

Thread: How to make QHttp detect a disconnect?

  1. #1
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default How to make QHttp detect a disconnect?

    I have some code downloading some file via QHttp, it works fine normally. WinXP, Qt4.2

    However, if I disconnect while the download is in progress (e.g., disconnect the network cable), my QHttp object (immediately) gives me a requestFinished(int, bool) signal but says there is no error (ie the bool parameter is false). I also get a done() signal indicating no error (ie the bool parameter is also false). So my code assumes the file is complete when it is actually just partially downloaded, and then operates on a corrupt file.

    Is there a way in Qt to detect this error case properly?
    Last edited by gfunk; 7th February 2007 at 01:16.
    Software Engineer



  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make QHttp detect a disconnect?

    You can compare the size of the file to the size announced in the response header. You can't really tell between a "good" and "bad" disconnect - in both cases the connection is broken.

  3. The following user says thank you to wysota for this useful post:

    gfunk (7th February 2007)

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.