TipcSrvWriteCbCreate create a write callback in the connection to RTserver
mt
message type to create callback for (null means global callback)
func
callback function
arg
user-defined argument to pass to func
New callback if successful, NULL
otherwise.
If TipcSrvWriteCbCreate fails, it returns NULL
and sets the global SmartSockets error number to one of:
TipcSrvWriteCbCreate creates a write callback in the connection to RTserver by calling TipcConnWriteCbCreate. These callbacks are called when a message is sent on the connection to RTserver. See TipcConnWriteCbCreate for more information on write callbacks.
TipcSrvWriteCbCreate may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvWriteCbCreate creates a write callback in the warm connection. See TipcSrvCreate on automatic creation of connections and warm connections to RTserver.
The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.
TipcConnWriteCbCreate, TipcSrvWriteCbLookup
This example creates a global write callback in the connection to RTserver that prints the name of the message type for each outgoing message:
/* =============================================================== */
/*..my_srv_write_cb -- print type name of outgoing message */
void T_ENTRY my_srv_write_cb(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_WRITE_CB_DATA data; T_CB_ARG arg;/* not used */
{ T_IPC_MSG msg = data->msg; T_IPC_MT mt; T_STR name; if (!TipcMsgGetType(msg, &mt)) {return
; /* error */
} if (!TipcMtGetName(mt, &name)) {return
; /* error */
}/* print the message type name */
TutOut("Outgoing message to RTserver with type %s.\n", name); }/* my_srv_write_cb */
/* =========================================================== */
/*...code from main program is below */
if (TipcSrvWriteCbCreate(NULL,/* NULL signifies global */
my_srv_write_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 |