TipcCbSrvError


Name

TipcCbSrvError — callback to handle errors on the connection to RTserver

Synopsis

void TipcCbSrvError(conn, data, arg) 
T_IPC_CONN conn; 
T_IPC_CONN_ERROR_CB_DATA data; 
T_CB_ARG arg; 

Arguments

conn — connection to RTserver

data — callback data

arg — callback argument (not used)

Return Values

None

Diagnostics

None

Description

TipcCbSrvError handles errors on the connection to RTserver. TipcCbSrvError first calls TipcSrvDestroy(T_IPC_SRV_CONN_WARM) to destroy the current connection to RTserver (but leave most information in a warm connection). TipcCbSrvError then calls TipcSrvCreate to create a new connection to RTserver. If the call to TipcSrvCreate fails, the warm connection remains and can be used later to create a new connection. See TipcSrvCreate for more information on warm connections to RTserver. TipcSrvCreate calls TipcSrvErrorCbCreate to create an error callback with function TipcCbSrvError and argument NULL.

Caution

TipcCbSrvError is not meant to be called directly and should only be used as a callback function.

See Also

TipcSrvCreate, TipcSrvDestroy, TipcSrvErrorCbCreate, TipcConnGmdResend

Examples

This example creates a connection to RTserver, changes the socket in the connection to an invalid socket, and attempts to read from the connection. This causes TipcCbSrvError to be called and shows how TipcCbSrvError recreates the connection to RTserver when an error occurs:

if (!TipcSrvCreate(T_IPC_SRV_CONN_FULL)) { 
  return;  /* error */ 
}  
 
/* 200000 is an impossibly large file descriptor */ 
if (!TipcSrvSetSocket(200000)) { 
  return;  /* error */ 
}  
 
TipcSrvRead(0.0); 

The output from the above fragment would be similar to this output:

Connecting to project <rtworks> on <_node> RTserver. 
Using local protocol. 
Message from RTserver: Connection established. 
Start subscribing to subject </_workstation1_23506>. 
WARNING: Lost connection to RTserver: error number = 1. 
close: Bad file number 
WARNING: TipcSrvDestroy: could not close socket. 
Attempting to reconnect to RTserver. 
Connecting to project <rtworks> on <_node> RTserver. 
Using local protocol. 
Message from RTserver: Connection established. 
Start subscribing to subject </_workstation1_23506> again. 

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