TipcSrvMonClientMsgTrafficPoll


Name

TipcSrvMonClientMsgTrafficPoll — poll once for RTclient message traffic information

Synopsis

T_BOOL TipcSrvMonClientMsgTrafficPoll(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 message traffic 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 message traffic information was successfully initiated, FALSE otherwise.

Diagnostics

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

Description

TipcSrvMonClientMsgTrafficPoll polls for RTclient message traffic information by sending a MON_CLIENT_MSG_TRAFFIC_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_TRAFFIC_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_MSG_TRAFFIC_POLL_RESULT message contains five fields:

In version 6.7 and later, the poll also returns these 8-byte variants of the previous fields. When these fields are present, they can be more accurate than their 4-byte counterparts (which may truncate the data):

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

To poll once for message traffic information by message type, use TipcSrvMonClientMsgTypePoll. To poll once for message traffic information by subject, use TipcSrvMonClientSubjectPoll.

To poll once for RTserver message traffic information, use TipcSrvMonServerMsgTrafficPoll.

For an example of how MON_CLIENT_MSG_TRAFFIC_POLL_RESULT messages can be used, see the RTmon GDI Client Message Traffic window.

Caution

TipcSrvMonClientMsgTrafficPoll sends a MON_CLIENT_MSG_TRAFFIC_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 message traffic information can only be polled, not watched.

See Also

TipcSrvMonClientSubjectPoll, TipcSrvMonClientMsgTypePoll, TipcSrvMonServerMsgTrafficPoll, TipcSrvConnMsgWrite

Examples

This example uses TipcSrvMonClientMsgTrafficPoll to poll for message traffic information in all RTclients (including this one), creates a callback to process the incoming MON_CLIENT_MSG_TRAFFIC_POLL_RESULT messages, and then waits up to 10 seconds for the poll results:

/* =============================================================== */ 
/*..process_mon_client_msg_traffic_poll_result -- process a 
MON_CLIENT_MSG_TRAFFIC_POLL_RESULT message */ 
 
void T_ENTRY process_mon_client_msg_traffic_poll_result 
( 
 T_IPC_CONN conn, 
 T_IPC_CONN_PROCESS_CB_DATA data, 
 T_CB_ARG arg 
) 
{ 
  T_STR client_name; 
  T_INT4 total_msg_send_4; 
  T_INT4 total_msg_recv_4; 
  T_INT4 total_byte_send_4; 
  T_INT4 total_byte_recv_4; 
  T_INT8 total_msg_send_8; 
  T_INT8 total_msg_recv_8; 
  T_INT8 total_byte_send_8; 
  T_INT8 total_byte_recv_8; 
 
  /* must set current field first */ 
  if (!TipcMsgSetCurrent(data->msg, 0)) { 
    return; return;  /* error */ 
  } 
 
  /* get the fields from the message */ 
  if (!TipcMsgRead(data->msg, T_IPC_FT_STR, &client_name, 
                              T_IPC_FT_INT4, &total_msg_send_4, 
                              T_IPC_FT_INT4, &total_msg_recv_4, 
                              T_IPC_FT_INT4, &total_byte_send_4, 
                              T_IPC_FT_INT4, &total_byte_recv_4, 
                              NULL)) { 
    return; return;  /* error */ 
  } 
 
  if (TipcMsgRead(data->msg, T_IPC_FT_INT8, &total_msg_recv_8, 
                             T_IPC_FT_INT8, &total_msg_send_8, 
                             T_IPC_FT_INT8, &total_byte_recv_8, 
                             T_IPC_FT_INT8, &total_byte_send_8, 
                             NULL)) { 
    TutOut("Got CLIENT_MSG_TRAFFIC poll result (64-bit data).\n"); 
    TutOut("RTclient name = %s\n", client_name); 
    /* 
     * 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 recv  = " T_INT8_SPEC "\n", 
total_msg_recv_8); 
    TutOut("Total msg sent  = " T_INT8_SPEC "\n", 
total_msg_send_8); 
    TutOut("Total byte recv = " T_INT8_SPEC "\n", 
total_byte_recv_8); 
    TutOut("Total byte sent = " T_INT8_SPEC "\n", 
total_byte_recv_8); 
  } 
  else { 
    TutOut("Got CLIENT_MSG_TRAFFIC poll result (32-bit data).\n"); 
    TutOut("RTclient name = %s\n", client_name); 
    TutOut("Total msg recv  = " T_INT4_SPEC "\n", 
total_msg_recv_4); 
    TutOut("Total msg sent  = " T_INT4_SPEC "\n", 
total_msg_send_4); 
    TutOut("Total byte recv = " T_INT4_SPEC "\n", 
total_byte_recv_4); 
    TutOut("Total byte sent = " T_INT4_SPEC "\n", 
total_byte_recv_4); 
  } 
} /* process_mon_client_msg_traffic_poll_result */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
T_IPC_MT mt; 
 
mt = TipcMtLookupByNum(T_MT_MON_CLIENT_MSG_TRAFFIC_POLL_RESULT); 
if (mt == NULL) { 
  return;  /* error */ 
} 
if (TipcSrvConnProcessCbCreate(srv, mt, 
                           
process_mon_client_msg_traffic_poll_result, 
                           NULL) == NULL) { 
  return;  /* error */ 
} 
 
/* send the poll request out to RTserver */ 
if (!TipcSrvMonClientMsgTrafficPoll(srv, "/...")) { 
  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