The socket is opened in the given openMode and first enters HostLookupState, then performs a host name lookup of hostName. If the lookup succeeds, hostFound() is emitted and QAbstractSocket enters ConnectingState. It then attempts to connect to the address or addresses returned by the lookup. Finally, if a connection is established, QAbstractSocket enters ConnectedState and emits connected().
Have a look at QAbstractSocket class:
Signals
void connected ()
void disconnected ()
void error ( QAbstractSocket::SocketError socketError )
void hostFound ()
void proxyAuthenticationRequired ( const QNetworkProxy & proxy, QAuthenticator * authenticator )
void stateChanged ( QAbstractSocket::SocketState socketState )