TipcSrvProcessCbCreate


Name

TipcSrvProcessCbCreate — create a process callback in the connection to RTserver

Synopsis

T_CB TipcSrvProcessCbCreate(mt, func, arg) 
T_IPC_MT mt; 
T_IPC_CONN_PROCESS_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

mt — message type to create callback for (null means global callback)

func — callback function

arg — user-defined argument to pass to func

Return Values

New callback if successful, NULL otherwise.

Diagnostics

If TipcSrvProcessCbCreate fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TipcSrvProcessCbCreate creates a process callback in the connection to RTserver by calling TipcConnProcessCbCreate. These callbacks are called by TipcSrvMsgProcess to perform the normal processing of a message. See TipcConnProcessCbCreate for more information on process callbacks.

TipcSrvProcessCbCreate may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvProcessCbCreate creates a process callback in the warm connection. See TipcSrvCreate on automatic creation of connections and warm connections to RTserver.

Caution

The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.

See Also

TipcConnProcessCbCreate, TipcSrvProcessCbLookup

Examples

This example creates a process callback for TIME messages in the connection to RTserver which prints the new time:

/* =============================================================== */ 
/*..my_time_process_cb -- process TIME messages */ 
void T_ENTRY my_time_process_cb(conn, data, arg) 
T_IPC_CONN conn; /* connection to RTserver */ 
T_IPC_CONN_PROCESS_CB_DATA data; 
T_CB_ARG arg; /* not used */ 
{ 
  T_REAL8 new_time; 
 
  if (!TipcMsgSetCurrent(data->msg, 0)) { 
    return;  /* error */ 
  }  
 
  if (!TipcMsgNextReal8(data->msg, &new_time)) { 
    return;  /* error */ 
  }  
 
  TutOut("New time is %s\n", TutRealToStr(new_time)); 
} /* my_time_process_cb */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
mt = TipcMtLookupByNum(T_MT_TIME); 
if (mt == NULL) { 
  return;  /* error */ 
}  
 
if (TipcSrvProcessCbCreate(mt, my_time_process_cb, NULL) 
    == NULL) { 
  return;  /* error */ 
}  

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com