TipcSrvMonServerNamesPoll


Name

TipcSrvMonServerNamesPoll — poll once for RTserver names

Synopsis

T_BOOL TipcSrvMonServerNamesPoll(srv) 
T_IPC_SRV srv; 

Arguments

srv — connection handle to RTserver

Return Values

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

Diagnostics

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

Description

TipcSrvMonServerNamesPoll polls for the RTserver names that match the value of the Monitor_Scope option by sending a MON_SERVER_NAMES_POLL_CALL message to RTserver. RTserver responds by sending back a MON_SERVER_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_SERVER_NAMES_POLL_RESULT message contains two fields:

To watch for created and destroyed RTserver names, use TipcSrvMonServerNamesSetWatch.

Caution

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

See Also

TipcSrvMonServerNamesGetWatch, TipcSrvMonServerNamesSetWatch, TipcSrvConnMsgWrite

Examples

This example uses TipcSrvMonServerNamesPoll to poll for RTserver 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 *server_names; 
T_INT4 num_server_names; 
T_STR *info_strs; 
T_INT4 counter; 
 
/* send the poll request out to RTserver */ 
if (!TipcSrvMonServerNamesPoll(srv)) { 
  return;  /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_MON_SERVER_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 */ 
} 
 
/* both server_names and info_strs contains the same number of elements */ 
if (!TipcMsgNextStrArray(msg, &server_names, &num_server_names) 
    || !TipcMsgNextStrArray(msg, &info_strs, &num_server_names)) { 
  return;  /* error */ 
} 
 
TutOut("Got SERVER_NAMES poll result.\n"); 
for (counter = 0; counter < num_server_names; counter++) { 
  TutOut("server_names[%d] = %s\n", counter, 
server_names[counter]); 
  TutOut("info_strs[%d] = %s\n", counter, info_strs[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