TipcMonServerRoutePoll poll once for RTserver route information
T_BOOL TipcMonServerRoutePoll(server_name
,dest_server_name
) T_STRserver_name
; T_STRdest_server_name
;
server_name
name of RTserver to poll for route information (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTservers matching the value of Monitor_Scope)
dest_server_name
name of destination RTserver whose route in RTserver to poll (use T_IPC_MON_ALL to indicate a poll of routes to all other RTservers)
TRUE
if the poll for RTserver route information was successfully initiated, FALSE
otherwise.
If TipcMonServerRoutePoll fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcMonServerRoutePoll polls for RTserver route information by sending a MON_SERVER_ROUTE_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 route information to the RTserver dest_server_name
is polled. The polled RTserver responds by sending back a MON_SERVER_ROUTE_POLL_RESULT message. The response should come back quickly. If dest_server_name
is T_IPC_MON_ALL then the routes in the polled RTserver to all other RTservers are polled. The polling RTclient can use functions such as TipcSrvMsgSearchType or TipcSrvMainLoop to get the response.
Each MON_SERVER_ROUTE_POLL_RESULT message contains one fixed field followed by one or more groups of four fields. The fixed field is a STR field containing the name of the RTserver. The group of four fields is:
There are multiple responses only if server_name
is a wildcard or T_IPC_MON_ALL.
TipcMonServerRoutePoll sends a MON_SERVER_ROUTE_POLL_CALL message to RTserver, but does not explicitly flush the message. See TipcSrvGetAutoFlushSize for more information on message routing.
There is no response message if the RTserver named server_name
or destination RTserver named dest_server_name
does not exist; the poll is silently dropped.
RTserver route information can only be polled, not watched.
TipcMonServerConnPoll, TipcSrvMsgWrite
This example uses TipcMonServerRoutePoll to poll for all route information in all RTservers, creates a callback to process the incoming MON_SERVER_ROUTE_POLL_RESULT messages, and then waits up to 10 seconds for the poll results:
/* =============================================================== */
/*..process_mon_server_route_poll_result -- process a MON_SERVER_ROUTE_POLL_RESULT message */
void T_ENTRY process_mon_server_route_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 dest_server_name; T_STR *connected_server_names; T_INT4 num_connected_server_names; T_INT4 distance; T_STR *route_to_server; T_INT4 num_route_to_server; T_INT4 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_ROUTE poll result.\n"); TutOut("RTserver name = %s\n", server_name);/* loop through all groups */
while (TipcMsgRead(data->msg, T_IPC_FT_STR, &dest_server_name, T_IPC_FT_STR_ARRAY, &connected_server_names, &num_connected_server_names, T_IPC_FT_INT4, &distance, T_IPC_FT_STR_ARRAY, &route_to_server, &num_route_to_server, NULL)) { TutOut("destination server name = %s\n", dest_server_name); TutOut("connected servers:\n"); for (counter = 0; counter < num_connected_server_names; counter++) { TutOut(" %s\n", connected_server_names[counter]); } TutOut("distance = %d\n", distance); TutOut("route:\n"); for (counter = 0; counter < num_route_to_server; counter++) { TutOut(" %s\n", route_to_server[counter]); } }/* make sure we reached the end of the message */
if (TutErrNumGet() != T_ERR_MSG_EOM) { return;/* error */
} }/* process_mon_server_route_poll_result */
/* =========================================================== */
/*...code from calling function is below */
T_IPC_MT mt;/* send the poll request out to RTserver */
if (!TipcMonServerRoutePoll("/...", T_IPC_MON_ALL)) {return;
/* error */
} mt = TipcMtLookupByNum(T_MT_MON_SERVER_ROUTE_POLL_RESULT); if (mt == NULL) {return;
/* error */
} if (TipcSrvProcessCbCreate(mt, process_mon_server_route_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 (!TipcSrvMainLoop(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 |