TipcSrvConnCloseCbCreate


Name

TipcSrvConnCloseCbCreate — create a server close callback

Synopsis

T_CB TipcSrvConnCloseCbCreate(srv, func, arg) 
T_IPC_SRV srv; 
T_IPC_SRV_DESTROY_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

srv — connection to RTserver

func — callback function

arg — user-defined argument to pass to func

Return Values

New callback if successful, NULL otherwise.

Diagnostics

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

Description

TipcSrvConnCloseCbCreate creates a server close callback. These callbacks are called when an RTclient closes its connection to RTserver. Server close callbacks are useful for breaking any dependencies that RTclient has on being connected to RTserver. See the TIBCO SmartSockets Utilities reference for more information on callbacks.

Server open callbacks are the opposite of server close callbacks. Server open callbacks can be used to perform processing when an RTclient opens a connection to RTserver. See TipcSrvConnOpenCbCreate for more information on server open callbacks.

When the callback function is called, the second function argument contains the callback data (C type T_IPC_SRV_CLOSE_CB_DATA). The fields old_conn_status and new_conn_status (both have C type T_IPC_SRV_CONN_STATUS) in this callback data can be used to determine the previous and current status of the connection to RTserver. See TipcSrvConnOpen for more information on automatic creation of connections and warm connections to RTserver.

Caution

The first argument passed to func is the current connection to RTserver. This argument is null if there is currently no connection to RTserver.

A server close callback should not call any of the TipcSrvConn* functions that attempt to automatically connect to RTserver, as this would cause the server close callback to reconnect to RTserver.

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

See Also

TipcSrvConnOpenCbCreate, TipcSrvConnCloseCbLookup; see the TIBCO SmartSockets Utilities for information on TutCbDestroy.

Examples

This example shows how to create a close callback on a connection to RTserver:

/*..my_server_close_cb -- server close callback */ 
void T_ENTRY my_server_close_cb( 
T_IPC_SRV srv; 
T_IPC_SRV_CLOSE_CB_DATA data; 
T_CB_ARG arg; 
) 
{ 
  /* any required processing here */ 
 
}   /* my_server_destroy_cb */ 
 
/* =========================================================== */ 
/*...code from main program is below */ 
 
if (TipcSrvConnCloseCbCreate(srv, my_server_close_cb, NULL) == 
NULL) { 
  return;  /* error */  
}  

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