TipcConnErrorCbCreate


Name

TipcConnErrorCbCreate — create an error callback in a connection

Synopsis

T_CB TipcConnErrorCbCreate(conn, func, arg) 
T_IPC_CONN conn; 
T_IPC_CONN_ERROR_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

conn — connection for which to create callback

func — callback function

arg — user-defined argument to pass to func

Return Values

New callback if successful, NULL otherwise.

Diagnostics

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

Description

TipcConnErrorCbCreate creates an error callback in a connection. These callbacks are called when an unrecoverable error occurs on a connection. The possible errors are:

Connection error callbacks usually take measures to re-establish the connection. See TIBCO SmartSockets Utilities for more information on callbacks.

Caution

A connection error callback function should not destroy the connection with TipcConnDestroy.

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

See Also

TipcConnErrorCbLookup; see the TIBCO SmartSockets Utilities for information on TutCbDestroy.

Examples

This example creates a connection error callback which prints a warning and sets a global flag to indicate that an error has occurred:

T_BOOL my_conn_error_happened = FALSE; 
 
/* =========================================================== */ 
/*..my_conn_error_cb -- connection error callback */ 
void T_ENTRY my_conn_error_cb(conn, data, arg) 
T_IPC_CONN conn; 
T_IPC_CONN_ERROR_CB_DATA data; 
T_CB_ARG arg; /* not used */ 
{ 
  TutWarning("Error <%s> occurred on my connection.\n", 
             TutErrNumToStr(data->err_num)); 
  my_conn_error_happened = TRUE; 
} /* my_conn_error_cb */ 
 
/* =========================================================== */ 
/*...code from calling fragment is below */ 
 
if (TipcConnErrorCbCreate(conn, my_conn_error_cb, NULL) == NULL) { 
  return;  /* error */ 
} 
 
/* Now use the global flag to check for errors. */ 
msg = TipcConnMsgNext(conn, T_TIMEOUT_FOREVER); 
if (msg == NULL && my_conn_error_happened) { 
  return;  /* error */ 
} 

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