TipcCbConnProcessKeepAliveCall callback to process KEEP_ALIVE_CALL messages from other end of connection
void TipcCbConnProcessKeepAliveCall(conn
,data
,arg
) T_IPC_CONNconn
; T_IPC_CONN_PROCESS_CB_DATAdata
; T_CB_ARGarg
;
conn
connection that KEEP_ALIVE_CALL message arrived on
data
callback data
arg
callback argument (printed with TutOut
if non-null)
None
None
TipcCbConnProcessKeepAliveCall processes a KEEP_ALIVE_CALL message that is received from the other end of a connection. A keep alive is an explicit attempt to check the health of a connection. See TipcConnKeepAlive for more information on keep alives.
TipcConnCreate calls TipcConnProcessCbCreate to create a process callback with message type KEEP_ALIVE_CALL, function TipcCbConnProcessKeepAliveCall, and argument NULL
. The argument may be changed by looking up the callback with TipcConnProcessCbLookup and then changing the callback argument with TutCbSetArgument.
TipcCbConnProcessKeepAliveCall first examines the argument arg
. If arg
is not null, it is treated as a string containing a diagnostic output message and is printed by calling this code (which is useful for testing):
TipcCbConnProcessKeepAliveCall then creates a KEEP_ALIVE_RESULT message, sends the message through the connection, and flushes the connection.
TipcCbConnProcessKeepAliveCall is not meant to be called directly and should only be used as a callback function.
TipcConnCreate, TipcConnKeepAlive, TipcConnProcessCbCreate
This example creates a client connection to a server, looks up the callback that uses TipcCbConnProcessKeepAliveCall, and changes the callback argument so that TipcCbConnProcessKeepAliveCall prints some output every time a keep alive is received:
T_IPC_CONN conn; T_IPC_MT mt; T_CB cb; conn = TipcConnCreateClient("local:_node:test.tmp"); if (conn == NULL) {
return
; /* error */
} mt = TipcMtLookupByNum(T_MT_KEEP_ALIVE_CALL); if (mt == NULL) {
return
; /* error */
} cb = TipcConnProcessCbLookup(conn, mt, TipcCbConnProcessKeepAliveCall, NULL); if (cb == NULL) {
return
; /* error */
} if (!TutCbSetArgument(cb, "***Received a keep alive***.\n")) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |