TipcSrvConnQueueCbCreate


Name

TipcSrvConnQueueCbCreate — create a queue callback in the connection

Synopsis

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

Description

TipcSrvConnQueueCbCreate 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.

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

TipcConnQueueCbCreate, TipcSrvConnQueueCbLookup

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; 
{ 
  T_INT4 num_queued; 
  T_IPC_SRV srv = arg; 
 
  if (!TipcSrvConnGetNumQueued(srv, &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 (TipcSrvConnQueueCbCreate(srv, NULL, /* NULL signifies global */ 
                             my_srv_queue_cb, 
                             srv) == NULL) { 
  return;  /* error */ 
}  

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