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. QtcpSocket states & disconnect signal
Forum Update on Monday, May 27th 2025

QtcpSocket states & disconnect signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtcpsocket
2 Posts 2 Posters 930 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by Dariusz
    #1

    Hey

    Out of these states >

                    switch (state) {
                        case QAbstractSocket::UnconnectedState:
                            break;
                        case QAbstractSocket::HostLookupState:
                            break;
                        case QAbstractSocket::ConnectingState:
                            break;
                        case QAbstractSocket::ConnectedState:
                            break;
                        case QAbstractSocket::BoundState:
                            break;
                        case QAbstractSocket::ListeningState:
                            break;
                        case QAbstractSocket::ClosingState:
                            break;
                    }
    

    Which one of them will fire disconnected signal?
    I guess that unconnected state/closing state I won't fire the signal, but in other states will?

    TIA

    1 Reply Last reply
    0
    • nageshN Offline
      nageshN Offline
      nagesh
      wrote on last edited by
      #2

      @Dariusz said in QtcpSocket states & disconnect signal:

      QAbstractSocket::UnconnectedState

      As per Qt Docs

      To close the socket, call disconnectFromHost(). QAbstractSocket enters QAbstractSocket::ClosingState. After all pending data has been written to the socket, QAbstractSocket actually closes the socket, enters QAbstractSocket::UnconnectedState, and emits disconnected().
      

      First enters the state then emits the signal,
      In this case UnconnectedState state and then emits disconnected().

      1 Reply Last reply
      1

      • Login

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