TipcSrvMonSubjectNamesPoll


Name

TipcSrvMonSubjectNamesPoll — poll once for subject names

Synopsis

T_BOOL TipcSrvMonSubjectNamesPoll(srv) 
T_IPC_SRV srv; 

Arguments

srv — connection handle to RTserver

Return Values

TRUE if the poll for subject names was successfully initiated, FALSE otherwise.

Diagnostics

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

Description

TipcSrvMonSubjectNamesPoll polls for the subject names in the current project that match the value of the Monitor_Scope option by sending a MON_SUBJECT_NAMES_POLL_CALL message to RTserver. RTserver responds by sending back a MON_SUBJECT_NAMES_POLL_RESULT message. The response should come back quickly. The polling RTclient can use functions such as TipcSrvConnMsgSearchType or TipcSrvConnMainLoop to get the response. The MON_SUBJECT_NAMES_POLL_RESULT message contains one field, a STR_ARRAY field containing the current subject names.

To watch for created and destroyed subject names, use TipcSrvMonSubjectNamesSetWatch.

Caution

TipcSrvMonSubjectNamesPoll sends a MON_SUBJECT_NAMES_POLL_CALL message to RTserver, but does not explicitly flush the message. See TipcSrvConnGetAutoFlushSize for more information on message buffering.

See Also

TipcSrvMonSubjectNamesGetWatch, TipcSrvMonSubjectNamesSetWatch, TipcSrvConnMsgWrite

Examples

This example uses TipcSrvMonSubjectNamesPoll to poll for subject names, 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 *subject_names; 
T_INT4 num_subject_names; 
T_INT4 counter; 
 
/* send the poll request out to RTserver */ 
if (!TipcSrvMonSubjectNamesPoll(srv)) { 
  return;  /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_MON_SUBJECT_NAMES_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, &subject_names, &num_subject_names)) 
{ 
  return;  /* error */ 
} 
 
TutOut("Got SUBJECT_NAMES poll result.\n"); 
for (counter = 0; counter < num_subject_names; counter++) { 
  TutOut("subject_names[%d] = %s\n", counter, 
subject_names[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