TipcSrvMonClientSubjectExPoll poll once for RTclient subject information
![]() |
This new function supersedes
TipcSrvMonClientSubjectPoll for clients that use release 6.7 or later.
|
T_BOOL TipcSrvMonClientSubjectExPoll(srv
,client_name
,subject_name
) T_IPC_SRVsrv
; T_STRclient_name
; T_STRsubject_name
;
srv
connection handle to RTserver
client_name
name of RTclient to poll for subject information (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTclients matching the value of Monitor_Scope)
subject_name
name of subject to poll for information (use T_IPC_MON_ALL to indicate a poll of all subjects in the polled RTclient)
TRUE
if the poll for RTclient subject information was successfully initiated, FALSE
otherwise.
If TipcSrvMonClientSubjectExPoll fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcSrvMonClientSubjectExPoll polls for RTclient subject information by sending a MON_CLIENT_SUBJECT_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_SUBJECT_EX_POLL_RESULT message. The response may or may not come back quickly, depending on what the polled RTclient is doing. If subject_name
is T_IPC_MON_ALL, then all subjects ever used in the polled RTclient are polled. The polling RTclient can use functions such as TipcSrvMsgSearchType or TipcSrvMainLoop to get the response.
Each MON_CLIENT_SUBJECT_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 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 TipcSrvMonClientMsgTrafficPoll. To poll once for message traffic information by message type, use TipcSrvMonClientMsgTypeExPoll.
For an example of how MON_CLIENT_SUBJECT_EX_POLL_RESULT messages can be used, see the RTmon GDI Client Subject Message Traffic window.
TipcSrvMonClientSubjectExPoll sends a MON_CLIENT_SUBJECT_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 subject named subject_name
does not exist; the poll is silently dropped.
RTclient subject information can only be polled, not watched.
There is no way to poll for RTserver subject information.
TipcSrvMonClientMsgTrafficPoll, TipcSrvConnMsgWrite
This example uses TipcSrvMonClientSubjectExPoll to poll for all subject information in all RTclients (including this one), creates a callback to process the incoming MON_CLIENT_SUBJECT_POLL_EX_RESULT messages, and then waits up to 10 seconds for the poll results:
/* =============================================================== */
/*..process_mon_client_subject_ex_poll_result -- process a
MON_CLIENT_SUBJECT_EX_POLL_RESULT message */
void process_mon_client_subject_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_STR *subject_name; T_INT4 num_subjects; 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, &client_name) || !TipcMsgNextStrArray(msg, &subject_name, &num_subjects) || !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;
return
; /* error */
} TutOut("Got CLIENT_SUBJECT_EX poll result.\n"); TutOut("RTclient name = %s\n", client_name);/* loop through all groups */
for (counter=0; counter<num_subjects; counter++) { TutOut("subject name = %s\n", subject_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_client_subject_poll_result *//* =========================================================== */
/*...code from calling function is below */
T_IPC_MT mt; mt = TipcMtLookupByNum(T_MT_MON_CLIENT_SUBJECT_EX_POLL_RESULT); if (mt == NULL) {
return
; /* error */
} if (TipcSrvConnProcessCbCreate(srv, mt, process_mon_client_subject_ex_poll_result, NULL) == NULL) {
return
; /* error */
}/* send the poll request out to RTserver */
if (!TipcSrvMonClientSubjectExPoll(srv, "/...", 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 (!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 |