Establishing a connection to a Gateway daemon

To use client applications in C in remote mode, you must establish a connection to the Gateway daemon Client protocol handler using the specified host name and port number.

The following functions establish a remote Client connection to a Gateway daemon:
int CTG_openRemoteGatewayConnection(
    char * address,
    int port,
    CTG_ConnToken_t* gwTokPtr,
    int connTimeout
)

int CTG_openRemoteGatewayConnectionApplid(
    char * address,
    int port,
    CTG_ConnToken_t* gwTokPtr,
    int connTimeout,
    char * applid,
    char * applidQualifier
)

Use CTG_openRemoteGatewayConnectionApplid in preference to CTG_openRemoteGatewayConnection, as this allows a Client APPLID and APPLID qualifier to be set enabling requests from the Client application to be tracked.

The connection to a Gateway daemon is established using the specified host name and port number. If the connection is successful the Gateway token is returned in the gwTokPtr parameter. The Gateway token is required to interact with that Gateway daemon on further API calls.

The following functions close a remote Client connection to a Gateway daemon:
CTG_closeGatewayConnection(CTG_GatewayToken_t * gwTokPtr)

CTG_closeAllGatewayConnections( )
The CTG_closeGatewayConnection function frees a single Gateway connection held by the API.

The CTG_closeAllGatewayConnections function attempts to free all resources held by the API, including open Gateway daemon connections. This function is for use in the event of a severe error because it enables some form of controlled shutdown even if all gateway tokens (gwTokens) have been lost.

Setting the client APPLID and APPLID qualifier using environment variables

The APPLID and APPLID qualifier of the client application can be overridden at run time by setting the environment variables CTG_APPLID and CTG_APPLIDQUALIFIER to the desired values. The environment variable values override any values passed to the CTG_openRemoteGatewayConnectionApplid function and are also available to existing ECI V2 and ESI V2 applications without requiring the application to be recompiled.


Concept Concept

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tg_latest/help/topic/com.ibm.cics.tg.doc//progde/C0300000.html