• 4586阅读
  • 0回复

[讨论]关于TcpSocket 状态检测 [复制链接]

上一主题 下一主题
离线yiweiwei3204
 

只看楼主 倒序阅读 楼主  发表于: 2012-12-13
关键词: 网络通信
在QTCPSOCKET类中
有<TD topAlign? rightAlign>void<TD bottomAlign?>stateChanged ( QAbstractSocket::SocketState socketState )这样一个信号,当socket状态改变比如(服务器断开),客户端能根据这样一个信号作出相应的处理。
下面是状态的枚举项
QAbstractSocket::UnconnectedState[/td]<TD topAlign?>0[td]The socket is not connected.
QAbstractSocket::HostLookupState[/td]<TD topAlign?>1[td]The socket is performing a host name lookup.
QAbstractSocket::ConnectingState[/td]<TD topAlign?>2[td]The socket has started establishing a connection.
QAbstractSocket::ConnectedState[/td]<TD topAlign?>3[td]A connection is established.
QAbstractSocket::BoundState[/td]<TD topAlign?>4[td]The socket is bound to an address and port (for servers).
QAbstractSocket::ClosingState[/td]<TD topAlign?>6[td]The socket is about to close (data may still be waiting to be written).
QAbstractSocket::ListeningState[/td]<TD topAlign?>5[td]For internal use only.

我想知道的是:Qt 他是如何检测套接字的状态的,从而发送这个信号。
求教........
快速回复
限100 字节
 
上一个 下一个