TipcSrvQueueCbCreate


Name

TipcSrvQueueCbCreate — create a queue callback in the connection to RTserver

Synopsis

T_CB TipcSrvQueueCbCreate(mt, func, arg) 
T_IPC_MT mt; 
T_IPC_CONN_QUEUE_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 TipcSrvQueueCbCreate fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TipcSrvQueueCbCreate creates a queue callback in the connection to RTserver by calling TipcConnQueueCbCreate. These callbacks are called when a message is inserted into or deleted from the message queue of the connection to RTserver. See TipcConnQueueCbCreate for more information on queue callbacks.

TipcSrvQueueCbCreate may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvQueueCbCreate creates a queue 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

TipcConnQueueCbCreate, TipcSrvQueueCbLookup

Examples

This example creates a global queue callback in the connection to RTserver which prints the number of queued messages:

void T_ENTRY my_srv_queue_cb(conn, data, arg) 
T_IPC_CONN conn; /* connection to RTserver */ 
T_IPC_CONN_QUEUE_CB_DATA data; 
T_CB_ARG arg; /* not used */ 
{ 
  T_INT4 num_queued; 
 
  if (!TipcSrvGetNumQueued(&num_queued)) { 
    return;  /* error */ 
  }  
 
  /* print the queue size */ 
  TutOut("Number of queued messages from RTserver is now %d.\n",    
         num_queued); 
} /* my_srv_queue_cb */ 
 
/* =========================================================== */ 
/*...code from main program is below */ 
 
if (TipcSrvQueueCbCreate(NULL, /* NULL signifies global */ 
                         my_srv_queue_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