TipcMonServerMsgTrafficExPoll poll once for RTserver message traffic information
![]() |
This new function supersedes
TipcMonServerMsgTrafficPoll for clients that use release 6.7 or later.
|
T_BOOL TipcMonServerMsgTrafficExPoll(server_name
,connected_process_name
) T_STRserver_name
; T_STRconnected_process_name
;
server_name
name of RTserver to poll for message traffic information (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTservers matching the value of Monitor_Scope)
connected_process_name
name of connected process whose message traffic in RTserver to poll (use T_IPC_MON_ALL to indicate a poll of all processes that the polled RTserver is connected to)
TRUE
if the poll for RTserver message traffic information was successfully initiated, FALSE
otherwise.
If TipcMonServerMsgTrafficExPoll fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcMonServerMsgTrafficExPoll polls for RTserver message traffic information by sending a MON_SERVER_MSG_TRAFFIC_EX_POLL_CALL message to the server_name
RTserver. The server_name
argument can be the unique subject name of a single RTserver, a wildcarded subject name to match many RTservers, or T_IPC_MON_ALL to poll all RTservers that match the value of the Monitor_Scope option. The message traffic information of connected_process_name
(which can be either an RTserver or another RTclient in the same project) is polled. The polled RTserver responds by sending back a MON_SERVER_MSG_TRAFFIC_EX_POLL_RESULT message. The response should come back quickly. If connected_process_name
is T_IPC_MON_ALL then the message traffic in the polled RTserver of all connected processes are polled. The polling RTclient can use functions such as TipcSrvMsgSearchType or TipcSrvMainLoop to get the response.
Each MON_SERVER_MSG_TRAFFIC_EX_POLL_RESULT message contains one fixed field followed by five array fields. The fixed field is a STR field containing the name of the RTserver.
The array fields are:
There are multiple responses only if server_name
is a wildcard or T_IPC_MON_ALL.
To poll once for RTclient message traffic information, use TipcMonClientMsgTrafficPoll.
For an example of how MON_SERVER_MSG_TRAFFIC_EX_POLL_RESULT messages can be used, see the RTmon GDI Watch Server Connections window.
TipcMonServerMsgTrafficPoll sends a MON_SERVER_MSG_TRAFFIC_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 RTserver named server_name
does not exist; the poll is silently dropped.
RTserver message traffic information can only be polled, not watched.
TipcMonClientMsgTrafficPoll, TipcSrvMsgWrite
This example uses TipcMonServerMsgTrafficExPoll to poll for all message traffic information in all RTservers, creates a callback to process the incoming MON_SERVER_MSG_TRAFFIC_EX_POLL_RESULT messages, and then waits up to 10 seconds for the poll results:
/* =============================================================== */
/*..process_mon_server_msg_traffic_ex_poll_result -- process a
MON_SERVER_MSG_TRAFFIC_EX_POLL_RESULT message */
void process_mon_server_msg_traffic_ex_poll_result ( T_IPC_CONN conn, T_IPC_CONN_PROCESS_CB_DATA data, T_CB_ARG arg ) { T_MSG msg; T_STR server_name; T_STR *process_name; T_INT4 num_processes; T_INT8 *total_msg_send; T_INT4 num_msg_send; T_INT8 *total_msg_recv; T_INT4 num_msg_recv; T_INT8 *total_byte_send; T_INT4 num_byte_send; T_INT8 *total_byte_recv; T_INT4 num_byte_recv; T_INT4 counter;/* must set current field first */
if (!TipcMsgSetCurrent(data->msg, 0)) {return;
/* error */
}/* get the fields from the message */
msg = data->msg; if (!TipcMsgNextStr(msg, &server_name) || !TipcMsgNextStrArray(msg, &process_name, &num_processes) || !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 SERVER_MSG_TRAFFIC_EX poll result.\n"); TutOut("RTserver name = %s\n", server_name);/* loop through all groups */
for (counter=0; counter<num_processes; counter++) { TutOut("connected process name = %s\n", process_name[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_server_msg_traffic_ex_poll_result */
/* =========================================================== */
/*...code from calling function is below */
T_IPC_MT mt; mt = TipcMtLookupByNum(T_MT_MON_SERVER_MSG_TRAFFIC_EX_POLL_RESULT); if (mt == NULL) {return;
/* error */
} if (TipcSrvProcessCbCreate(mt, process_mon_server_msg_traffic_ex_poll_result, NULL) == NULL) {return;
/* error */
}/* send the poll request out to RTserver */
if (!TipcMonServerMsgTrafficExPoll("/...", 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 |