TipcSrvConnOpenCbCreate


Name

TipcSrvConnOpenCbCreate — create a server open callback

Synopsis

T_CB TipcSrvConnOpenCbCreate(srv, func, arg) 
T_IPC_SRV srv; 
T_IPC_SRV_CREATE_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 TipcSrvConnOpenCbCreate fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TipcSrvConnOpenCbCreate creates a server open callback. These callbacks are called when an RTclient creates a warm or full connection to RTserver. See the TIBCO SmartSockets Utilities reference for more information on callbacks.

Server close callbacks are the opposite of server open callbacks. Server close callbacks can be used to perform processing when RTclient closes its connection to RTserver. See TipcSrvConnCloseCbCreate for more information on server close callbacks.

When the callback function is called, the second function argument contains the callback data (C type T_IPC_SRV_OPEN_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. The field old_conn_status contains either the value T_IPC_SRV_CONN_NONE or the value T_IPC_SRV_CONN_WARM. The field new_conn_status contains the value T_IPC_SRV_CONN_WARM or the value T_IPC_SRV_CONN_FULL.

See TipcSrvConnOpen for more information on automatic creation of connections and warm connections to RTserver.

Caution

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

See Also

TipcSrvConnOpenCbLookup, TipcSrvConnCloseCbCreate; see the TIBCO SmartSockets Utilities for information on TutCbDestroy

Examples

This example shows an application that creates a server open callback which is used to print a message when a new server connection is made:

#include <rtworks/ipc.h> 
 
/* =============================================================== * 
/*..my_server_open_cb -- server open callback */ 
void T_ENTRY my_server_open_cb(srv, data, arg) 
T_IPC_SRV srv; 
T_IPC_SRV_OPEN_CB_DATA data; 
T_CB_ARG arg; /* not used */ 
{ 
  TutOut("Server connection opened.\n"); 
} /* my_server_open_cb */ 
 
/* =============================================================== * 
/*..main -- main program */ 
int main(int argc, char **argv) 
{ 
  T_IPC_SRV srv; 
 
  /* create a connection handle to RTserver */ 
  if ((srv = TipcSrvConnCreate(NULL, NULL, NULL, NULL)) == NULL) { 
    return;  /* error */  
  }  
 
  /* create a callback to be called whenever we connect */ 
  /* to RTserver */ 
  if (TipcSrvConnOpenCbCreate(my_server_open_cb, NULL) == NULL) { 
    return;  /* error */  
  }  
 
} /* main */ 

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