Purpose
Find out if any, and how many, connections
to the iSeries™ system
that are using the specified system object currently exist.
Syntax
UINT CWB_ENTRY cwbCO_IsConnected(
cwbCO_SysHandle system,
cwbCO_Service service,
PULONG numberOfConnections );
Parameters
- cwbCO_SysHandle system - input
- Handle returned previously from cwbCO_CreateSystem or cwbCO_CreateSystemLike.
It identifies the iSeries system.
- cwbCO_Service service - input
- The service to check for a connection. Any of the cwbCO_Service values
listed in Defines for cwbCO_Service are
valid. To find out if ANY service is connected, specify CWBCO_SERVICE_ANY.
To find out how many services are connected using this system object, specify
CWBCO_SERVICE_ALL.
- PULONG numberOfConnections - output
- Used to return the number of connections active for the service(s) that
are specified. If the service specified is not CWBCO_SERVICE_ALL, the value
returned will be either 0 or 1, since there can be at most one active connection
per service per system object. If CWBCO_SERVICE_ALL is specified, this could
be from zero to the possible number of services, since one connection per
service might be active.
Return Codes
The following list shows common return
values.
- CWB_OK
- Successful completion, all services specified are connected, or if CWBCO_SERVICE_ANY
is specified, at least one service is connected.
- CWB_NOT_CONNECTED
- If a single service was specified, that service is not connected. If the
value CWBCO_SERVICE_ANY was specified, there are NO active connections. If
the value CWBCO_SERVICE_ALL was specified, there is at least one service that
is NOT connected.
- CWB_INVALID_API_HANDLE
- Invalid system handle.
- CWB_SERVICE_NAME_ERROR
- The service identifier is invalid.
- CWB_INVALID_POINTER
- The numberOfConnections parameter is NULL.
Usage
If CWBCO_SERVICE_ALL was specified and CWB_NOT_CONNECTED
is returned, there may be some active connections, and the count of active
connections still will be passed back. To find out how many connections through
the specified system object exist, call this API and specify CWBCO_SERVICE_ALL.
If the return code is either CWB_OK or CWB_NOT_CONNECTED, the number of connections
that exist is stored in numberOfConnections.