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. Qt5 QTcpSocket, Windows 10, connectToHost waits infinitely if destination no available
Forum Update on Monday, May 27th 2025

Qt5 QTcpSocket, Windows 10, connectToHost waits infinitely if destination no available

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 359 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.
  • G Offline
    G Offline
    gkavrecic
    wrote on last edited by
    #1

    I've noticed on Windows 10 that (in most occasions) when a connection drops and the destination server is not ready when I retry the second time, then connectToHost would wait infinitely, does not return timeout error.

    Any idea how to solve this?

    JonBJ 1 Reply Last reply
    0
    • G gkavrecic

      I've noticed on Windows 10 that (in most occasions) when a connection drops and the destination server is not ready when I retry the second time, then connectToHost would wait infinitely, does not return timeout error.

      Any idea how to solve this?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @gkavrecic
      Is anything in https://forum.qt.io/topic/97149/can-i-set-the-timeout-value-on-qabstractsocket-connecttohost relevant to you?

      G 1 Reply Last reply
      0
      • G Offline
        G Offline
        gkavrecic
        wrote on last edited by
        #3

        @JonB
        Thanks for the hint.
        As the QNetworkConfig is marked obsolete I'll go with the timer approach.
        Altough think the QSocket object shall have this setting. Or even the connectToHost shall have an optional parameter with timeout.

        1 Reply Last reply
        0
        • JonBJ JonB

          @gkavrecic
          Is anything in https://forum.qt.io/topic/97149/can-i-set-the-timeout-value-on-qabstractsocket-connecttohost relevant to you?

          G Offline
          G Offline
          gkavrecic
          wrote on last edited by gkavrecic
          #4

          @JonB
          I've applied the proposed approach and works as expected.

          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