ctGetConnectionInfo

Returns information for multiple connections in a single call.

Declaration

NINT ctGetConnectionInfo(NINT versn,pctCONINF pconninfo,pNINT pnconnections);

Description

When retrieving connection information for many connected c-tree clients, FairCom DB Monitor could take a very long time to return. The bulk of this time was spent in client-by-client connection returns. To reduce this expensive network traffic, a new function was added to obtain all connection information in a single API call. This function is available for all client applications.

FairCom Server now supports a function that returns information for multiple connections in a single call. Prior to the availability of this function, a function call from the client to the Server was required for obtaining information about each connection of interest. This new approach greatly reduces network traffic.

Note: The caller must be a member of the ADMIN group; otherwise the function returns error LADM_ERR (589).

Version 1 structure:


/* Output data format for ctGetConnectionInfo() function: */
typedef struct ctconinf {
 COUNT utaskid;     /* internal task id           */
 COUNT uactflg;     /* active request indicator   */
 LONG umemsum;      /* user memory                */
 LONG ulogtim;      /* logon time                 */
 LONG ucurtim;      /* current time               */
 LONG urqstim;      /* time of last request       */
 LONG utrntim;      /* time of last TRANBEG       */
 LONG unbrfil;      /* number of open files       */
 LONG urqstfn;      /* last request function #    */
 ULONG sipaddr;     /* client IP address          */
 ULONG sip6addr[4]; /* client IPv6 address        */
 TEXT unodnam[32];  /* node ID information        */
 TEXT uname[32];    /* user id string             */
 TEXT ucominfo[32]; /* communication info         */
 TEXT urqst[32];    /* last request function name */
 } ctCONINF, ctMEM *pctCONINF;

Return Values

Value Symbolic Constant Explanation
0 CTDBRET_OK Successful operation.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example


 NINT rc,nconnect;
 ctCONINF conninfo[32];

 nconnect = 32;
 if ((rc = ctGetConnectionInfo(ctCONINF_VERS_V01,conninfo,&nconnect))) {
  printf("Error: %d\n", rc);
 } else {
  printf("Current number of connections: %d\n", nconnect);
 }