TipcSrvMonServerGeneralPoll


Name

TipcSrvMonServerGeneralPoll — poll once for RTserver general information

Synopsis

T_BOOL TipcSrvMonServerGeneralPoll(srv, server_name) 
T_IPC_SRV srv; 
T_STR server_name; 

Arguments

srv — connection handle to RTserver

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

Return Values

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

Diagnostics

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

Description

TipcSrvMonServerGeneralPoll polls for RTserver general information by sending a MON_SERVER_GENERAL_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_GENERAL_POLL_RESULT message. The response should come back quickly. The polling RTclient can use functions such as TipcSrvConnMsgSearchType or TipcSrvConnMainLoop to get the response.

Each MON_SERVER_GENERAL_POLL_RESULT message contains seventeen fields:

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

To poll once for RTclient general information, use TipcSrvMonClientGeneralPoll.

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

Caution

TipcSrvMonServerGeneralPoll sends a MON_SERVER_GENERAL_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 does not exist; the poll is silently dropped.

RTserver general information can only be polled, not watched.

See Also

TipcSrvMonClientGeneralPoll, TipcSrvConnMsgWrite

Examples

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

/* =============================================================== */ 
/*..process_mon_server_general_poll_result -- process a 
MON_SERVER_GENERAL_POLL_RESULT message */ 
void T_ENTRY process_mon_server_general_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 ident; 
  T_STR node_name; 
  T_STR user_name; 
  T_INT4 pid; 
  T_STR arch; 
  T_INT4 current_sbrk; 
  T_INT4 delta_sbrk; 
  T_INT2 int_format; 
  T_INT2 real_format; 
  T_STR cmd_file_name; 
  T_INT4 no_daemon_flag; 
  T_INT4 cmd_mode_flag; 
  T_STR *direct_client_names; 
  T_INT4 num_direct_client_names; 
  T_STR *direct_server_names; 
  T_INT4 num_direct_server_names; 
  T_STR *server_subscribes; 
  T_INT4 num_server_subscribes; 
  T_STR *client_subscribes; 
  T_INT4 num_client_subscribes; 
  T_INT4 counter; 
     
  /* must set current field first */ 
  if (!TipcMsgSetCurrent(data->msg, 0)) { 
    return;  /* error */ 
  }  
 
  /* get the fields from the message */ 
  if (!TipcMsgRead(data->msg,  
                   T_IPC_FT_STR, &server_name, 
                   T_IPC_FT_STR, &ident, 
                   T_IPC_FT_STR, &node_name, 
                   T_IPC_FT_STR, &user_name, 
                   T_IPC_FT_INT4, &pid, 
                   T_IPC_FT_STR, &arch, 
                   T_IPC_FT_INT4, &current_sbrk, 
                   T_IPC_FT_INT4, &delta_sbrk, 
                   T_IPC_FT_INT2, &int_format, 
                   T_IPC_FT_INT2, &real_format, 
                   T_IPC_FT_STR, &cmd_file_name, 
                   T_IPC_FT_INT4, &no_daemon_flag,  
                   T_IPC_FT_INT4, &cmd_mode_flag,  
                   T_IPC_FT_STR_ARRAY, &direct_client_names, 
                     &num_direct_client_names, 
                   T_IPC_FT_STR_ARRAY, &direct_server_names, 
                     &num_direct_server_names, 
                   T_IPC_FT_STR_ARRAY, &server_subscribes, 
                     &num_server_subscribes, 
                   T_IPC_FT_STR_ARRAY, &client_subscribes, 
                     &num_client_subscribes, 
                    NULL)) { 
    return;  /* error */ 
  }  
 
  TutOut("Got SERVER_GENERAL poll result.\n"); 
  TutOut("RTserver name = %s\n", server_name); 
  TutOut("ident = %s\n", ident); 
  TutOut("node name = %s\n", node_name); 
  TutOut("user name = %s\n", user_name); 
  TutOut("pid = %d\n", pid); 
  TutOut("architecture = %s\n", arch); 
  TutOut("current sbrk value = %d\n", current_sbrk); 
  TutOut("delta sbrk value = %d\n", delta_sbrk); 
  TutOut("int format = %d\n", int_format); 
  TutOut("real format = %d\n", real_format); 
  TutOut("cmd file name = %s\n", cmd_file_name); 
  TutOut("-no_daemon flag = %s\n", no_daemon_flag ? "TRUE" : 
"FALSE"); 
  TutOut("-cmd_mode flag = %s\n", cmd_mode_flag ? "TRUE" : 
"FALSE"); 
 
  TutOut("  direct client names:"); 
  for (counter = 0; counter < num_direct_client_names; counter++) { 
    TutOut(" %s", direct_client_names[counter]); 
  } 
  TutOut("\n"); 
 
  TutOut("  direct server names:"); 
  for (counter = 0; counter < num_direct_server_names; counter++) { 
    TutOut(" %s", direct_server_names[counter]); 
  } 
  TutOut("\n"); 
 
  TutOut("  server subscribes:"); 
  for (counter = 0; counter < num_server_subscribes; counter++) { 
    TutOut(" %s", server_subscribes[counter]); 
  } 
  TutOut("\n"); 
  TutOut("  client subscribes:"); 
  for (counter = 0; counter < num_client_subscribes; counter++) { 
    TutOut(" %s", client_subscribes[counter]); 
  } 
  TutOut("\n"); 
} /* process_mon_server_general_poll_result */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
T_IPC_MT mt; 
 
/* send the poll request out to RTserver */ 
if (!TipcSrvMonServerGeneralPoll(srv, "/...")) { 
  return;  /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_MON_SERVER_GENERAL_POLL_RESULT); 
if (mt == NULL) { 
  return;  /* error */ 
} 
if (TipcSrvConnProcessCbCreate(srv, mt, 
process_mon_server_general_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