TipcMonServerConnPoll


Name

TipcMonServerConnPoll — poll once for RTserver connections

Synopsis

T_BOOL TipcMonServerConnPoll() 

Arguments

None

Return Values

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

Diagnostics

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

Description

TipcMonServerConnPoll polls for RTserver connections of the RTservers that match the value of the Monitor_Scope option by sending a MON_SERVER_CONN_POLL_CALL message to RTserver. RTserver responds by sending back a MON_SERVER_CONN_POLL_RESULT message. The response should come back quickly. The polling RTclient can use functions such as TipcSrvMsgSearchType or TipcSrvMainLoop to get the response.

The MON_SERVER_CONN_POLL_RESULT message contains four fields (all the array fields have the same number of elements):

To watch for created and destroyed RTserver connections, use TipcMonServerConnSetWatch.

Caution

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

See Also

TipcMonServerConnGetWatch, TipcMonServerConnSetWatch, TipcSrvMsgWrite

Examples

This example uses TipcMonServerConnPoll to poll for RTserver connections, 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 *server1_names; 
T_INT4 num_fields; 
T_STR *server2_names; 
T_STR *conn_names; 
T_INT4 *weights; 
T_INT4 counter; 
 
/* send the poll request out to RTserver */ 
if (!TipcMonServerConnPoll()) { 
  return; /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_MON_SERVER_CONN_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 */ 
} 
 
/* all fields contains the same number of elements */ 
if (!TipcMsgNextStrArray(msg, &server1_names, &num_fields) 
    || !TipcMsgNextStrArray(msg, &server2_names, &num_fields) 
    || !TipcMsgNextStrArray(msg, &conn_names, &num_fields) 
    || !TipcMsgNextInt4Array(msg, &weights, &num_fields)) { 
  return; /* error */ 
} 
 
TutOut("Got SERVER_CONN poll result.\n"); 
for (counter = 0; counter < num_fields; counter++) { 
  TutOut("server1_names[%d] = %s\n", counter, 
server1_names[counter]); 
  TutOut("server2_names[%d] = %s\n", counter, 
server2_names[counter]); 
  TutOut("conn_names[%d] = %s\n", counter, conn_names[counter]); 
  TutOut("weights[%d] = %d\n", counter, weights[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