TipcCbConnProcessKeepAliveCall


Name

TipcCbConnProcessKeepAliveCall — callback to process KEEP_ALIVE_CALL messages from other end of connection

Synopsis

void TipcCbConnProcessKeepAliveCall(conn, data, arg) 
T_IPC_CONN conn; 
T_IPC_CONN_PROCESS_CB_DATA data; 
T_CB_ARG arg; 

Arguments

conn — connection that KEEP_ALIVE_CALL message arrived on

data — callback data

arg — callback argument (printed with TutOut if non-null)

Return Values

None

Diagnostics

None

Description

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):

TutOut("%s", arg); 

TipcCbConnProcessKeepAliveCall then creates a KEEP_ALIVE_RESULT message, sends the message through the connection, and flushes the connection.

Caution

TipcCbConnProcessKeepAliveCall is not meant to be called directly and should only be used as a callback function.

See Also

TipcConnCreate, TipcConnKeepAlive, TipcConnProcessCbCreate

Examples

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