TipcSrvConnErrorCbCreate create an error callback in the connection
T_CB TipcSrvConnErrorCbCreate(srv,
func
,arg
) T_IPC_SRVsrv
; T_IPC_CONN_ERROR_CB_FUNCfunc
; T_CB_ARGarg
;
srv
connection handle to RTserver
func
callback function
arg
user-defined argument to pass to func
New callback if successful, NULL
otherwise.
If TipcSrvConnErrorCbCreate fails, it returns NULL
and sets the global SmartSockets error number to one of:
TipcSrvConnErrorCbCreate 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.
TipcSrvConnErrorCbCreate may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvConnErrorCbCreate creates an error callback in the warm connection. See TipcSrvConnOpen for more information on automatic creation of connections and warm connections to RTserver.
When an RTclient creates a connection to RTserver with TipcSrvConnCreate, 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).
The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.
TipcCbSrvError, TipcConnErrorCbCreate, TipcSrvConnErrorCbLookup; see the TIBCO SmartSockets Utilities for information on TutCbDestroy.
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 = TipcSrvConnErrorCbLookup(srv, TipcCbSrvError, NULL); if (cb == NULL) {return
; /* error */
} if (!TutCbGetPriority(cb, &priority)) {return
; /* error */
} cb = TipcSrvConnErrorCbCreate(srv, 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 |