The connection object CclConn has three methods which can be used to determine the availability of the server connection that it represents.
The following example shows how server availability can be monitored in a Client application that is busy doing something else.
class ChgFlow : public CclFlow {
public:
ChgFlow( Ccl::Sync stype ) : CclFlow( stype ) {}
void handleReply( CclBuf* ) {
CclConn* ccon = connection();
cout << ccon-> serverName() << " is "
<< ccon-> serverStatusText() << endl;
ChgFlow* sflow = new ChgFlow( Ccl::async );
ccon-> changed( *sflow );
}
};
int numservs = myeci.serverCount();
CclConn* pcon;
ChgFlow* pflo;
for ( int i = 1; i <= numservs ; i++ ) {
pcon = new CclConn( myeci.serverName( i ) );
pflo = new ChgFlow( Ccl::async );
pcon-> status( *pflo );
}
…
PROD1 is unavailable
DEVTSERV is unavailable
PROD1 is available
Initially, both servers are unavailable
because the ECI Client application is
not running. It starts, and after a while makes contact with one
of the servers.