Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkRequest or QNetworkReply timeout
Forum Update on Monday, May 27th 2025

QNetworkRequest or QNetworkReply timeout

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    halfgaar
    wrote on last edited by halfgaar
    #1

    From what I can find and what I see in my tests, QNetworkRequest still doesn't have a timeout (QT 5.1 in my case). Is that true? But why does the NetworkError then have a TimeoutError?

    Edit: actually, I do see now that a timeout can occur, it's just very long. I can't seem to find a way to set a timeout to another value. Is there a way?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BERGLE
      wrote on last edited by
      #2

      Maybe you can start an extra timer for checking the state, stopping the request... ?

      1 Reply Last reply
      0
      • H Offline
        H Offline
        halfgaar
        wrote on last edited by
        #3

        I use timers now, but it's error prone and a bit clunky. You can forgot to connect QTimer::timeout() to QNetworkReply::deleteLater, or to connect QNetworkReply::finished to QTimer::stop, or any other boiler plate code. If you do, you get very weird effects, such as your normal slots being activated after timeout already having occurred.

        There is an open bugreport about it, on which I commented.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved