TipcMonClientSubscribeNumPoll


Name

TipcMonClientSubscribeNumPoll — poll for the number of subjects subscribed to by an RTclient

Synopsis

T_BOOL TipcMonClientSubscribeNumPoll(client_name) 
T_STR client_name; 

Arguments

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)

Return Values

TRUE if the poll for the number of subjects was successfully initiated, FALSE otherwise.

Diagnostics

If TipcMonClientSubscribeNumPoll fails, it returns FALSE and sets the global SmartSockets error number to:

Description

TipcMonClientSubscribeNumPoll 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 RTserver responds by sending back a MON_CLIENT_SUBSCRIBE_NUM_POLL_RESULT message. The response should come back quickly.

Each MON_CLIENT_SUBSCRIBE_NUM_POLL_RESULT message contains two fields:

Caution

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

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

The number of subjects subscribed to by an RTclient can only be polled, not watched.

See Also

TipcMonClientSubscribePoll

Examples

This example uses TipcMonClientSubscribeNumPoll to poll for the number of subjects that all RTclients are subscribing to, waits up to 10 seconds for the poll result, and then 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; 
T_INT4 counter; 
 
/* send the poll request out to RTserver */ 
if (!TipcMonClientSubscribeNumPoll(T_IPC_MON_ALL)) { 
  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 = TipcSrvMsgSearchType(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