TipcMonClientMsgTypeExPoll


Name

TipcMonClientMsgTypeExPoll — poll once for RTclient message type information

This new function supersedes TipcMonClientMsgTypePoll for clients that use release 6.7 or later.

Synopsis

T_BOOL TipcMonClientMsgTypeExPoll(client_name, msg_type_name) 
T_STR client_name; 
T_STR msg_type_name; 

Arguments

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

msg_type_name — name of message type to poll for information (use T_IPC_MON_ALL to indicate a poll of all message types)

Return Values

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

Diagnostics

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

Description

TipcMonClientMsgTypeExPoll polls for RTclient message type information by sending a MON_CLIENT_MSG_TYPE_EX_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_MSG_TYPE_EX_POLL_RESULT message. The response may or may not come back quickly, depending on what the polled RTclient is doing. If msg_type_name is T_IPC_MON_ALL, then all message types in the polled RTclient are polled. The polling RTclient can use functions such as TipcSrvMsgSearchType or TipcSrvMainLoop to get the response.

Each MON_CLIENT_MSG_TYPE_EX_POLL_RESULT message contains one fixed field and fifteen array fields. The fixed field is a STR field containing the name of the RTclient. The array fields are:

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

To poll once for global message traffic information, use TipcMonClientMsgTrafficExPoll. To poll once for message traffic information by subject, use TipcMonClientSubjectExPoll. To poll once for global callback information, use TipcMonClientCbPoll.

Caution

TipcMonClientMsgTypeExPoll sends a MON_CLIENT_MSG_TYPE_EX_POLL_CALL message to RTserver, but does not explicitly flush the message. See TipcSrvGetAutoFlushSize for more information on message buffering.

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

RTclient message type information can only be polled, not watched.

There is no way to poll for RTserver message type information.

See Also

TipcMonClientCbPoll, TipcMonClientSubjectExPoll, TipcMonClientMsgTrafficPoll, TipcSrvMsgWrite

Examples

This example uses TipcMonClientMsgTypeExPoll to poll for all message type information in all RTclients (including this one), creates a callback to process the incoming MON_CLIENT_MSG_TYPE_EX_POLL_RESULT messages, and then waits up to 10 seconds for the poll results.

/* =============================================================== */ 
/*..process_mon_client_msg_type_ex_poll_result -- process a 
MON_CLIENT_MSG_TYPE_EX_POLL_RESULT message */ 
 
void process_mon_client_msg_type_ex_poll_result 
( 
 T_IPC_CONN conn, 
 T_IPC_CONN_PROCESS_CB_DATA data, 
 T_CB_ARG arg 
) 
{ 
  T_MSG   msg; 
  T_STR   client_name; 
  T_INT4  counter; 
  T_STR   delivery_mode_str = ""; 
 
  /* So many arrays... */ 
  T_STR  *msg_type_name; 
  T_INT4 *msg_num; 
  T_STR  *grammar; 
  T_INT4 *priority_known; /* really (T_BOOL) */ 
  T_INT2 *priority; /* not applicable if priority_known is FALSE */ 
  T_INT4 *delivery_mode; /* really T_IPC_DELIVERY_MODE */ 
  T_INT4 *user_prop; 
  T_INT4 *num_read_cb; 
  T_INT4 *num_write_cb; 
  T_INT4 *num_process_cb; 
  T_INT4 *num_queue_cb; 
  T_INT8 *total_msg_send; 
  T_INT8 *total_msg_recv; 
  T_INT8 *total_byte_send; 
  T_INT8 *total_byte_recv; 
 
  T_INT4  num_msg_type_name; 
  T_INT4  num_msg_num; 
  T_INT4  num_grammar; 
  T_INT4  num_priority_known; 
  T_INT4  num_priority; 
  T_INT4  num_delivery_mode; 
  T_INT4  num_user_prop; 
  T_INT4  num_num_read_cb; 
  T_INT4  num_num_write_cb; 
  T_INT4  num_num_process_cb; 
  T_INT4  num_num_queue_cb; 
  T_INT4  num_msg_send; 
  T_INT4  num_msg_recv; 
  T_INT4  num_byte_send; 
  T_INT4  num_byte_recv; 
 
  /* must set current field first */ 
  if (!TipcMsgSetCurrent(data->msg, 0)) { 
    return; /* error */ 
  } 
 
  /* get the fields from the message */ 
  msg = data->msg; 
  if (!TipcMsgNextStr(msg, &client_name) 
   || !TipcMsgNextStrArray(msg, &msg_type_name, &num_msg_type_name) 
   || !TipcMsgNextInt4Array(msg, &msg_num, &num_msg_num) 
   || !TipcMsgNextStrArray(msg, &grammar, &num_grammar) 
   || !TipcMsgNextInt4Array(msg, &priority_known, 
&num_priority_known) 
   || !TipcMsgNextInt2Array(msg, &priority, &num_priority) 
   || !TipcMsgNextInt4Array(msg, &delivery_mode, 
&num_delivery_mode) 
   || !TipcMsgNextInt4Array(msg, &user_prop, &num_user_prop) 
   || !TipcMsgNextInt4Array(msg, &num_read_cb, &num_num_read_cb) 
   || !TipcMsgNextInt4Array(msg, &num_write_cb, &num_num_write_cb) 
   || !TipcMsgNextInt4Array(msg, &num_process_cb, 
&num_num_process_cb) 
   || !TipcMsgNextInt4Array(msg, &num_queue_cb, &num_num_queue_cb) 
   || !TipcMsgNextInt8Array(msg, &total_msg_send, &num_msg_send) 
   || !TipcMsgNextInt8Array(msg, &total_msg_recv, &num_msg_recv) 
   || !TipcMsgNextInt8Array(msg, &total_byte_send, &num_byte_send) 
   || !TipcMsgNextInt8Array(msg, &total_byte_recv, &num_byte_recv)) 
{ 
    return; /* error */ 
  } 
  TutOut("Got CLIENT_MSG_TYPE_EX poll result.\n"); 
  TutOut("RTclient name = %s\n", client_name); 
 
  /* loop through all groups */ 
  for (counter=0; counter<num_msg_type_name; counter++) { 
    TutOut("message type name = %s\n", msg_type_name[counter]); 
    TutOut("num = %d\n", msg_num[counter]); 
    TutOut("grammar = %s\n", grammar[counter]); 
    if (priority_known[counter]) { 
      TutOut("priority = %d\n", priority[counter]); 
    } 
    else { 
      TutOut("priority = unknown\n"); 
    } 
    TipcDeliveryModeToStr(delivery_mode[counter], 
&delivery_mode_str); 
    TutOut("delivery mode = %s\n", delivery_mode_str); 
    TutOut("user prop = " T_INT4_SPEC "\n", 
           user_prop[counter]); 
    TutOut("num read cb = " T_INT4_SPEC "\n", 
           num_read_cb[counter]); 
    TutOut("num write cb = " T_INT4_SPEC "\n", 
           num_write_cb[counter]); 
    TutOut("num process cb = " T_INT4_SPEC "\n", 
           num_process_cb[counter]); 
    TutOut("num queue cb = " T_INT4_SPEC "\n", 
           num_queue_cb[counter]); 
    /* 
     * IMPORTANT: The format string for T_INT8 differs by platform. 
     * The T_INT8_SPEC utility macro supplies the correct format 
     * string for each platform. 
     */ 
    TutOut("total msg send = " T_INT8_SPEC "\n", 
           total_msg_send[counter]); 
    TutOut("total msg recv = " T_INT8_SPEC "\n", 
           total_msg_recv[counter]); 
    TutOut("total byte send = " T_INT8_SPEC "\n", 
           total_byte_send[counter]); 
    TutOut("total byte recv = " T_INT8_SPEC "\n", 
           total_byte_recv[counter]); 
  } 
 
} /* process_mon_client_msg_type_poll_result */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
T_IPC_MT mt; 
 
mt = TipcMtLookupByNum(T_MT_MON_CLIENT_MSG_TYPE_EX_POLL_RESULT); 
if (mt == NULL) { 
    return; /* error */ 
} 
if (TipcSrvProcessCbCreate(mt, 
                           
process_mon_client_msg_type_ex_poll_result, 
                           NULL) == NULL) { 
  return; /* error */ 
} 
 
/* send the poll request out to RTserver */ 
if (!TipcMonClientMsgTypeExPoll("/...", T_IPC_MON_ALL)) { 
    return; /* error */ 
} 
 
/* read and process all poll results (as well as any other incoming 
messages) that arrive within the next 10 seconds */ 
if (!TipcSrvMainLoop(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