TipcSrvMonServerCongestionSetWatch start or stop watching for congestion in the RTserver write buffer of a connected process
T_BOOL TipcSrvMonServerCongestionSetWatch(srv
,server_name
,connected_process_name
,high_water
,low_water
,watch_status
) T_IPC_SRVsrv
; T_STRserver_name
; T_STRconnected_process_name
; T_INT4high_water
; T_INT4low_water
; T_BOOLwatch_status
;
srv
connection handle to RTserver
server_name
name of RTserver to set watch status (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTservers matching the value of Monitor_Scope)
connected_process_name
the name of the process whose write buffer status you want to start or stop watching (use T_IPC_MON_ALL to indicate a poll of all processes that the polled RTserver is connected to)
high_water
the number of pending bytes that must be in a buffer for it to be considered congested
low_water
the quantity that the number of pending bytes must fall below to end buffer congestion
watch_status
new watch status (TRUE
to start watching, or FALSE
to stop watching)
TRUE
if the watch status was successfully set, FALSE
otherwise.
If TipcSrvMonServerCongestionSetWatch fails, it returns FALSE
and sets the global SmartSockets error number to:
TipcSrvMonServerCongestionSetWatch starts or stops the watch of the connected_process_name
write buffer in the server_name
RTserver. The connected_process_name
argument can be the name of any RTclient connected to server_name
, or T_IPC_MON_ALL to indicate a poll of all processes that the polled RTserver is connected to. 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 srv
argument indicates the connection on which the watch is to be set.
TipcSrvMonServerCongestionSetWatch saves the watch status and sends a MON_SERVER_CONGESTION_SET_WATCH message to the server_name
RTserver. The watch status controls whether the RTclient receives a MON_SERVER_CONGESTION_STATUS message when the number of bytes in the process's write buffer passes the high_water
or low_water
threshold. When the write buffer reaches high_water
messages pending, the RTserver sends a MON_SERVER_CONGESTION_STATUS message. The next MON_SERVER_CONGESTION_STATUS message is sent when the number of bytes in the write buffer reaches the low_water
number.
The watch status is saved internally so the RTclient can automatically resume watching all appropriate categories if RTclient has to reconnect to RTserver.
Each MON_SERVER_CONGESTION_STATUS message contains five fields:
high_water
or low_water
number)server_name
connected_process_name
TRUE
for the high_water
threshold, FALSE
if the low_water
threshold was passed)
Once the number of bytes in the write buffer has reached the high_water
number, RTserver does not send another MON_SERVER_CONGESTION_STATUS message until number of pending bytes in the buffer decreases to the low_water
number.
TipcSrvMonServerCongestionSetWatch sends a MON_SERVER_CONGESTION_SET_WATCH message to RTserver, but does not explicitly flush the message. See TipcSrvConnGetAutoFlushSize for more information on message buffering.
Write buffer congestion can only be watched, not polled.
TipcSrvMonServerCongestionGetWatch, TipcSrvMonClientCongestionSetWatch, TipcSrvMonClientCongestionGetWatch
This example uses TipcSrvMonServerCongestionSetWatch to start watching buffer congestion in all connection buffers in all RTservers. The high_water
threshold is 8 million bytes and the low_water
threshold is 2 million bytes. The example creates a callback to process incoming MON_SERVER_CONGESTION_STATUS messages:
/* =============================================================== */
/*..process_mon_server_congestion_status – process a
MON_SERVER_CONGESTION_STATUS message */
void process_mon_server_congestion_status(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_PROCESS_CB_DATA data; T_CB_ARG arg; { T_INT4 size; T_INT4 threshold; T_STR server_name; T_STR connected_process_name; T_BOOL high_water;/* 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_INT4, &size, T_IPC_FT_INT4, &threshold, T_IPC_FT_STR, &server_name, T_IPC_FT_STR, &connected_process_name, T_IPC_FT_BOOL, &high_water, NULL)) {return
; /* error */
} TutOut("Got SERVER_CONGESTION status.\n"); TutOut("Crossed %s water threshold.\n", high_water ? "high" : "low"); TutOut("RTserver name = %s\n", server_name); TutOut("connected process name = %s\n", connected_process_name); TutOut("buffer size = %d\n", size); TutOut("threshold = %d\n", threshold); }/* process_mon_server_congestion_status */
/* =============================================================== */
/*...code from calling function is below */
T_IPC_MT mt;/* send the poll request out to RTserver */
if (!TipcSrvMonServerCongestionSetWatch (srv, "/...", T_IPC_MON_ALL, 8000000, 2000000, TRUE)) {return
; /* error */
} mt = TipcMtLookupByNum(T_MT_MON_SERVER_CONGESTION_STATUS); if (mt == NULL) {return
; /* error */
} if (TipcSrvConnProcessCbCreate(srv, mt, process_mon_server_congestion_status, NULL) == NULL) {return
; /* error */
}/* At this point TipcSrvConnMainLoop can be used to read and process messages. */
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |