TipcSrvConnProcessCbCreate


Name

TipcSrvConnProcessCbCreate — create a process callback in the connection

Synopsis

T_CB TipcSrvConnProcessCbCreate(srv, mt, func, arg) 
T_IPC_SRV srv; 
T_IPC_MT mt; 
T_IPC_CONN_PROCESS_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

srv — connection handle to RTserver

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 TipcSrvConnProcessCbCreate fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

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

TipcSrvConnProcessCbCreate may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvConnProcessCbCreate creates a process callback in the warm connection. See TipcSrvConnOpen for more information 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, TipcSrvConnProcessCbLookup

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 (TipcSrvConnProcessCbCreate(srv, 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