TipcSrvMonClientCbPoll


Name

TipcSrvMonClientCbPoll — poll once for RTclient callback information

Synopsis

T_BOOL TipcSrvMonClientCbPoll(srv, client_name) 
T_IPC_SRV srv; 
T_STR client_name; 

Arguments

srv — connection handle to RTserver

client_name — name of RTclient to poll for callback information (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTclients matching the value of Monitor_Scope)

Return Values

TRUE if the poll for RTclient callback information was successfully initiated, FALSE otherwise.

Diagnostics

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

Description

TipcSrvMonClientCbPoll polls for RTclient callback information by sending a MON_CLIENT_CB_POLL_CALL message to the client_name RTclient. The client_name argument can be the unique subject name of a single RTclient, a wildcarded subject name to match many RTclients, or T_IPC_MON_ALL to poll all RTclients in the project that match the value of the Monitor_Scope option. The polled RTclient responds by sending back a MON_CLIENT_CB_POLL_RESULT message. The response may or may not come back quickly, depending on what the polled RTclient is doing. The polling RTclient can use functions such as TipcSrvConnMsgSearchType or TipcSrvConnMainLoop to get the response.

Each MON_CLIENT_CB_POLL_RESULT message contains nine fields:

There are multiple responses only if client_name is a wildcard or T_IPC_MON_ALL.

Caution

TipcSrvMonClientCbPoll sends a MON_CLIENT_CB_POLL_CALL message to RTserver, but does not explicitly flush the message. See TipcSrvConnGetAutoFlushSize for more information on message buffering.

There is no response message if the RTclient named client_name does not exist; the poll is silently dropped.

RTclient callback information can only be polled, not watched.

There is no way to poll for RTserver callback information.

See Also

TipcSrvMonClientMsgTrafficPoll, TipcSrvConnMsgWrite, TipcSrvConnGetAutoFlushSize

Examples

This example uses TipcSrvMonClientCbPoll to poll for callback information in all RTclients, including this one, creates a callback to process the incoming MON_CLIENT_CB_POLL_RESULT messages, and then waits up to 10 seconds for the poll results:

/* =============================================================== */ 
/*..process_mon_client_cb_poll_result -- process a MON_CLIENT_CB_POLL_RESULT message 
*/ 
void T_ENTRY process_mon_client_cb_poll_result(conn, data, arg) 
T_IPC_CONN conn; 
T_IPC_CONN_PROCESS_CB_DATA data; 
T_CB_ARG arg; 
{ 
  T_STR client_name; 
  T_INT4 num_global_read_cb; 
  T_INT4 num_global_write_cb; 
  T_INT4 num_global_process_cb; 
  T_INT4 num_global_queue_cb; 
  T_INT4 num_default_cb; 
  T_INT4 num_error_cb; 
  T_INT4 num_server_create_cb; 
  T_INT4 num_server_destroy_cb; 
   
  /* must set current field first */ 
  if (!TipcMsgSetCurrent(data->msg, 0)) { 
    return;  /* error */ 
  } 
 
  /* get the fields from the message */ 
  if (!TipcMsgRead(data->msg, 
                   T_IPC_FT_STR, &client_name, 
                   T_IPC_FT_INT4, &num_global_read_cb, 
                   T_IPC_FT_INT4, &num_global_write_cb, 
                   T_IPC_FT_INT4, &num_global_process_cb, 
                   T_IPC_FT_INT4, &num_global_queue_cb, 
                   T_IPC_FT_INT4, &num_default_cb, 
                   T_IPC_FT_INT4, &num_error_cb, 
                   T_IPC_FT_INT4, &num_server_create_cb, 
                   T_IPC_FT_INT4, &num_server_destroy_cb, 
                   NULL)) { 
    return;  /* error */ 
  } 
 
  TutOut("Got CLIENT_CB poll result.\n"); 
  TutOut("RTclient name = %s\n", client_name); 
  TutOut("num global read cb = %d\n", num_global_read_cb); 
  TutOut("num global write cb = %d\n", num_global_write_cb); 
  TutOut("num global process cb = %d\n", num_global_process_cb); 
  TutOut("num global queue cb = %d\n", num_global_queue_cb); 
  TutOut("num default cb = %d\n", num_default_cb); 
  TutOut("num error cb = %d\n", num_error_cb); 
  TutOut("num server create cb = %d\n", num_server_create_cb); 
  TutOut("num server destroy cb = %d\n", num_server_destroy_cb); 
} /* process_mon_client_cb_poll_result */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
T_IPC_MT mt; 
 
/* send the poll request out to RTserver */ 
if (!TipcSrvMonClientCbPoll(srv, "/...")) { 
  return;  /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_MON_CLIENT_CB_POLL_RESULT); 
if (mt == NULL) { 
  return;  /* error */ 
} 
 
if (TipcSrvConnProcessCbCreate(srv, mt, 
                               process_mon_client_cb_poll_result, 
                               NULL) == NULL) { 
  return;  /* error */ 
} 
 
/* read and process all poll results (as well as any other incoming 
messages) that arrive within the next 10 seconds */ 
if (!TipcSrvConnMainLoop(srv, 10.0)) { 
  return;  /* error */ 
} 

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