QtcpSocket states & disconnect signal
Unsolved
General and Desktop
-
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
-
@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().