TipcSrvMonServerOptionPoll


Name

TipcSrvMonServerOptionPoll — poll once for RTserver option information

Synopsis

T_BOOL TipcSrvMonServerOptionPoll(srv, server_name, option_name) 
T_IPC_SRV srv; 
T_STR server_name; 
T_STR option_name; 

Arguments

srv — connection handle to RTserver

server_name — name of RTserver to poll for option information (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTservers matching the value of Monitor_Scope)

option_name — name of option to poll for information (use T_IPC_MON_ALL to indicate a poll of all options)

Return Values

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

Diagnostics

If TipcSrvMonServerOptionPoll fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TipcSrvMonServerOptionPoll polls for RTserver option information by sending a MON_SERVER_OPTION_POLL_CALL message to the server_name RTserver. The server_name argument can be the unique subject name of a single RTserver, a wildcarded subject name to match many RTservers, or T_IPC_MON_ALL to poll all RTservers that match the value of the Monitor_Scope option. The polled RTserver responds by sending back a MON_SERVER_OPTION_POLL_RESULT message. The response should come back quickly. If option_name is T_IPC_MON_ALL then all options in the polled RTserver are polled. The polling RTclient can use functions such as TipcSrvConnMsgSearchType or TipcSrvConnMainLoop to get the response.

Each MON_SERVER_OPTION_POLL_RESULT message contains one fixed field followed by one or more groups of five fields. The fixed field is a STR field containing the name of the RTserver. The group of five fields is:

There are multiple responses only if server_name is a wildcard or T_IPC_MON_ALL.

To poll once for RTclient option information, use TipcSrvMonClientOptionPoll.

For an example of how MON_SERVER_OPTION_POLL_RESULT messages can be used, see the RTmon GDI Server Information window.

Caution

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

There is no response message if the RTserver named server_name or the option named option_name does not exist; the poll is silently dropped.

RTserver option information can only be polled, not watched.

See Also

TipcSrvMonClientOptionPoll, TipcSrvConnMsgWrite

Examples

This example uses TipcSrvMonServerOptionPoll to poll for all option information in all RTservers, creates a callback to process the incoming MON_SERVER_OPTION_POLL_RESULT messages, and then waits up to 10 seconds for the poll results:

/* =============================================================== */ 
/*..process_mon_server_option_poll_result -- process a 
MON_SERVER_OPTION_POLL_RESULT message */ 
void T_ENTRY process_mon_server_option_poll_result(conn, data, 
arg) 
T_IPC_CONN conn; 
T_IPC_CONN_PROCESS_CB_DATA data; 
T_CB_ARG arg; 
{ 
  T_STR server_name; 
  T_STR option_name; 
  T_INT2 type; /* really (T_OPT_TYPE) */ 
  T_STR value_str; 
  T_INT4 required; /* really (T_BOOL) */ 
  T_STR *legal_vals; 
  T_INT4 num_legal_vals; /* is zero if legal_vals not applicable */ 
  T_INT4 counter; /* loop counter */ 
   
  /* must set current field first */ 
  if (!TipcMsgSetCurrent(data->msg, 0)) { 
    return;  /* error */ 
  } 
 
  /* get first fixed field */ 
  if (!TipcMsgNextStr(data->msg, &server_name)) { 
    return;  /* error */ 
  } 
  TutOut("Got SERVER_OPTION poll result.\n"); 
  TutOut("RTserver name = %s\n", server_name); 
 
  /* loop through all groups */ 
  while (TipcMsgRead(data->msg,  
                     T_IPC_FT_STR, &option_name, 
                     T_IPC_FT_INT2, &type, 
                     T_IPC_FT_STR, &value_str, 
                     T_IPC_FT_INT4, &required, 
                     T_IPC_FT_STR_ARRAY, &legal_vals, 
&num_legal_vals, 
                     NULL)) { 
    TutOut("option name = %s\n", option_name); 
    TutOut("type = %d\n", type); 
    TutOut("value str = %s\n", value_str); 
    TutOut("required = %s\n", required ? "TRUE" : "FALSE"); 
    if (num_legal_vals > 0) { 
      TutOut("legal vals:\n"); 
      for (counter = 0; counter < num_legal_vals; counter++) { 
        TutOut("  %s\n", legal_vals[counter]); 
      } 
    } 
  } 
 
  /* make sure we reached the end of the message */ 
  if (TutErrNumGet() != T_ERR_MSG_EOM) { 
    return;  /* error */ 
  } 
} /* process_mon_server_option_poll_result */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
T_IPC_MT mt; 
 
/* send the poll request out to RTserver */ 
if (!TipcSrvMonServerOptionPoll(srv, "/...", T_IPC_MON_ALL)) { 
  return;  /* error */ 
}  
mt = TipcMtLookupByNum(T_MT_MON_SERVER_OPTION_POLL_RESULT); 
if (mt == NULL) { 
  return;  /* error */ 
} 
 
if (TipcSrvConnProcessCbCreate(srv, mt, 
                               process_mon_server_option_poll_result, 
	                               NULL) == NULL) { 
  return;  /* error */ 
} 
 
/* read and process all poll results (as well as any other incoming 
messages) that arrive within the next 10 seconds */ 
if (!TipcSrvConnMainLoop(srv, 10.0)) { 
  return;  /* error */ 
}  

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com