TipcSrvErrorCbCreate


Name

TipcSrvErrorCbCreate — create an error callback in the connection to RTserver

Synopsis

T_CB TipcSrvErrorCbCreate(func, arg) 
T_IPC_CONN_ERROR_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

func — callback function

arg — user-defined argument to pass to func

Return Values

New callback if successful, NULL otherwise.

Diagnostics

If TipcSrvErrorCbCreate fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TipcSrvErrorCbCreate creates an error callback in the connection to RTserver by calling TipcConnErrorCbCreate. These callbacks are called when there is an unrecoverable error on the connection to RTserver. See TipcConnErrorCbCreate for more information on error callbacks.

TipcSrvErrorCbCreate may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvErrorCbCreate creates an error callback in the warm connection. See TipcSrvCreate on automatic creation of connections and warm connections to RTserver.

When an RTclient creates a connection to RTserver with TipcSrvCreate, an error callback is created in the connection with function TipcCbSrvError, argument null, and priority 0. TipcCbSrvError restarts RTserver, reconnects to RTserver, starts subscribing to the necessary subjects again, and starts watching the necessary subjects again. If an RTclient needs to take any additional recovery steps, such as checking for application-specific hardware failures, it can create an error callback with a lower priority (which is called after TipcCbSrvError).

Caution

The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.

See Also

TipcCbSrvError, TipcConnErrorCbCreate, TipcSrvErrorCbLookup; see the TIBCO SmartSockets Utilities for information on TutCbDestroy.

Examples

This example creates an error callback for the connection to RTserver that is called before the error callback TipcCbSrvError:

/* =============================================================== */ 
/*..my_srv_error_cb -- example server error callback func */ 
void T_ENTRY my_srv_error_cb(conn, data, arg) 
T_IPC_CONN conn; 
T_IPC_CONN_ERROR_CB_DATA data; 
T_CB_ARG arg; 
{ 
  /* perform necessary error recovery here */ 
} /* my_srv_error_cb */ 
 
 
/*...fragment that uses above function is shown below */ 
 
T_CB cb; 
T_CB_PRIORITY priority; 
 
cb = TipcSrvErrorCbLookup(TipcCbSrvError, NULL); 
if (cb == NULL) { 
  return;  /* error */ 
} 
 
if (!TutCbGetPriority(cb, &priority)) { 
  return;  /* error */ 
} 
 
cb = TipcSrvErrorCbCreate(my_srv_error_cb, NULL); 
if (cb == NULL) { 
  return;  /* error */ 
} 
 
if (!TutCbSetPriority(cb, priority + 1)) { 
  return;  /* error */ 
} 

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