TipcSrvMonServerStartTimePoll poll once for RTserver start time and elapsed time
srv
connection handle to RTserver
server_name
name of RTserver to poll for time information (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTservers matching the value of Monitor_Scope)
TRUE
if the poll was successfully initiated, FALSE
otherwise.
If TipcSrvMonServerStartTimePoll fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcSrvMonServerStartTimePoll polls for RTserver start time and elapsed time by sending a MON_SERVER_START_TIME_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_START_TIME_POLL_RESULT message. The polling RTclient can use functions such as TipcSrvConnMsgSearchType or TipcSrvConnMainLoop to get the response.
Each MON_SERVER_START_TIME_POLL_CALL message contains three fields:
There are multiple responses only if server_name
is a wildcard or T_IPC_MON_ALL.
TipcSrvMonServerStartTimePoll sends a MON_SERVER_START_TIME_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 time information can be polled, but it cannot be watched.
This example uses TipcSrvMonServerStartTimePoll to poll for start time and elapsed time in all RTservers, creates a callback to process the incoming MON_SERVER_START_TIME_POLL_RESULT messages, then waits up to 10 seconds for the poll results:
void T_ENTRY ServerStartTimeCb(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_PROCESS_CB_DATA data; T_CB_ARG arg; { T_STR server_name; T_REAL8 start_time; T_REAL8 elapsed; T_INT4 days = 0; T_INT4 hours = 0; T_INT4 minutes = 0; T_INT4 seconds = 0; TipcMsgNextStr(data->msg, &server_name); TipcMsgNextReal8(data->msg, &start_time); TipcMsgNextReal8(data->msg, &elapsed); if (elapsed > 86400.0 ) { days = (T_INT4)floor(elapsed / 86400); elapsed -= days*86400; } if (elapsed > 3600.0) { hours = (T_INT4)floor(elapsed / 3600); elapsed -= hours*3600; } if (elapsed > 60.0) { minutes = (T_INT4)floor(elapsed / 60); elapsed -= minutes*60; } seconds = elapsed; TutOut("RTserver was started %d days %d hours %d minutes %d seconds ago\n", days, hours, minutes, seconds); } /* ServerStartTimeCb */ /* ... code from calling function is below */ T_IPC_MT mt; mt = TipcMtLookupByNum(T_MT_MON_SERVER_START_TIME_POLL_RESULT); if (mt == NULL) {return
; /* error */
} if (TipcSrvConnProcessCbCreate(srv, mt, ServerStartTimeCb, NULL) == NULL) {return
; /* error */
} TipcSrvMonServerStartTimePoll(srv, "/..."); TipcSrvConnFlush(srv); 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 |