TipcSrvMonClientSubscribeNumPoll poll for the number of subjects subscribed to by an RTclient
srv
connection handle to RTserver
client_name
name of RTclient to poll (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTclients matching the value of Monitor_Scope)
TRUE
if the poll for the number of subjects was successfully initiated, FALSE
otherwise.
If TipcSrvMonClientSubscribeNumPoll fails, it returns FALSE
and sets the global SmartSockets error number to:
TipcSrvMonClientSubscribeNumPoll polls for the number of subjects subscribed to by an RTclient by sending a MON_CLIENT_SUBSCRIBE_NUM_POLL_CALL message to the RTserver. 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 srv
argument indicates the connection on which the poll is to be sent.
The RTserver responds by sending back a MON_CLIENT_SUBSCRIBE_NUM_POLL_RESULT message. The response may or may not come back quickly, depending on what the polled RTclient is doing. Each MON_CLIENT_SUBSCRIBE_NUM_POLL_RESULT message contains two fields:
There is no response message if the RTclient named client_name
does not exist; the poll is silently dropped.
TipcSrvMonClientSubscribeNumPoll sends a MON_CLIENT_SUBSCRIBE_NUM_POLL_CALL message to RTserver, but does not explicitly flush the message. See TipcSrvConnGetAutoFlushSize for more information on message buffering.
The number of subjects subscribed to by an RTclient can only be polled, not watched.
This example uses TipcSrvMonClientSubscribeNumPoll to poll for the number of subjects that all RTclients are subscribing to, waits up to 10
seconds for the poll result, and prints the poll result message:
T_IPC_MT mt; T_IPC_MSG msg; T_STR *client_names; T_INT4 num_client_names; T_INT4 *num_subject_subscribes; T_INT4 num_num_subject_subscribes;/* send the poll request out to RTserver */
if (!TipcSrvMonClientSubscribeNumPoll(srv)) {return
; /* error */
} mt = TipcMtLookupByNum(T_MT_MON_CLIENT_SUBSCRIBE_NUM_POLL_RESULT); if (mt == NULL) {return
; /* error */
}/* wait up to 10 seconds for the poll result */
msg = TipcSrvConnMsgSearchType(srv, 10.0, mt); if (msg == NULL) {return
; /* error */
}/* set the current field to the first field */
if (!TipcMsgSetCurrent(msg, 0)) {return
; /* error */
} if (!TipcMsgNextStrArray(msg, &client_names, &num_client_names) || !TipcMsgNextInt4Array(msg, &num_subject_subscribes, &num_num_subject_subscribes)) {return
; /* error */
} TutOut("Got CLIENT_SUBSCRIBE_NUM poll result.\n"); for (counter = 0; counter < num_client_names; counter++) { TutOut("client_names[%d] = %s\n", counter, client_names[counter]); TutOut("num_subject_subscribes[%d] = %d\n", counter, num_subject_subscribes[counter]); }/* clean up */
if (!TipcMsgDestroy(msg)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |