TipcSrvCreateCbCreate


Name

TipcSrvCreateCbCreate — create a server create callback

Synopsis

T_CB TipcSrvCreateCbCreate(func, arg) 
T_IPC_SRV_CREATE_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

func — callback function

arg — user-defined argument to pass to func

Return Values

New callback if successful, NULL otherwise.

Diagnostics

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

Description

TipcSrvCreateCbCreate creates a server create 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 destroy callbacks are the opposite of server create callbacks. Server destroy callbacks can be used to perform processing when RTclient destroys its connection to RTserver. See TipcSrvDestroyCbCreate for more information on server destroy callbacks.

When the callback function is called, the second function argument contains the callback data (C type T_IPC_SRV_CREATE_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 TipcSrvCreate 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

TipcSrvCreateCbLookup, TipcSrvDestroyCbCreate; see the TIBCO SmartSockets Utilities for information on TutCbDestroy

Examples

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

#include <rtworks/ipc.h> 
 
/* ===============================================================* 
/*..my_server_create_cb -- server create callback */ 
void T_ENTRY my_server_create_cb(conn, data, arg) 
T_IPC_CONN conn; 
T_IPC_SRV_CREATE_CB_DATA data; 
T_CB_ARG arg; /* not used */ 
{ 
  TutOut("Server connection created.\n"); 
} /* my_server_create_cb */ 
 
/* =============================================================== * 
/*..main -- main program */ 
int main(int argc, char **argv) 
{ 
  /* create a callback to be called whenever we connect */ 
  /* to RTserver */ 
  if (TipcSrvCreateCbCreate(my_server_create_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