TipcEventCreateMsgType


Name

TipcEventCreateMsgType — create a message event that is invoked based on a message’s type

Synopsis

T_IPC_EVENT TipcEventCreatMsgType(dispatcher, srv, mt, event_func, 
event_arg) 
T_IPC_DISPATCHER dispatcher; 
T_IPC_SRV srv; 
T_IPC_MT mt; 
T_IPC_EVENT_FUNC event_func; 
T_PTR event_arg; 

Arguments

dispatcher — the dispatcher on which to invoke the event

srv — an RTserver connection to wait for messages on

mt — the message type that triggers the event

event_func — the function to be invoked

event_arg — an optional argument to pass to the event_func

Return Values

A new event if successful, NULL otherwise.

Diagnostics

If TipcEventCreateMsgType fails, it returns FALSE and sets the global SmartSockets error number to:

Description

TipcEventCreateMsgType creates a message event of type T_IPC_EVENT_MSG_TYPE to be invoked when a message arrives on the srv connection whose destination matches the mt.

Caution

The message must not be destroyed from within the event’s callback function. SmartSockets manages the message and automatically destroys the message once all events are dispatched. If you need to keep a copy of the message, call TipcMsgClone.

See Also

TipcEventGetType, TipcEventCreateMsg

Examples

This example creates a message event triggered by a message’s type:

void T_ENTRY msgTypeFunc(T_IPC_EVENT event, T_IPC_EVENT_DATA data, 
                         T_PTR arg) 
{ 
  TipcMsgPrint(data->msg, TutOut); 
} 
 
/* =========================================================== */ 
/*...code from main program is below */ 
 
msg_event = TipcEventCreateMsgType(dispatcher, srv, mt, 
                                   msgTypeFunc, T_NULL); 
if (msg_event == NULL) { 
  return;  /* error */ 
} 

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