对于VB的WinSocket,当state=7时候表示连接中
其他状态表示未连接那么IdTCPClient控件,和IdTCPServer控件的哪个属性表示连接状态的??比方连接成功就True
连接断开,或者未连接那么就False????????????谢谢各位了

解决方案 »

  1.   

    在其 OnStatus 事件中,根据 AStatus的状态来取得:Represents the connection status for a component.
    TIdStatus = (hsResolving, hsConnecting, hsConnected, hsDisconnecting, hsDisconnected, hsStatusText, ftpTransfer, ftpReady, ftpAborted);
    Unit
    IdComponent
    Description
    TIdStatus is an enumerated type that represents the connection status for an Indy component. TIdStatus can contain one of the following values:hsResolving - A host name is being resolved to an IP AddresshsConnecting - A connection is being openedhsConnected - A connection has been madehsDisconnecting - The connection is being closedhsDisconnected - The connection has been closedhsText - The connection is generating an informational message
      

  2.   

    在OnStatus事件中,写代码:
    if AStatus=hsConnected then
      ShowMessage('已经连接');
      

  3.   

    楼上说的确实可以实现状态的检测,但是仅仅根据客户端的连接而检测也就是说,客户端是断开,或者连接,或者其他状态时候OnStatus根据进行判断但是如果是服务器端断开了连接,那么客户端的OnStatus事件就没有那么时时性了??