在其 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
在OnStatus事件中,写代码: if AStatus=hsConnected then ShowMessage('已经连接');
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
if AStatus=hsConnected then
ShowMessage('已经连接');