TipcSrvMonClientCongestionSetWatch start or stop watching for congestion in an RTclient’s write buffer
T_BOOL TipcSrvMonClientCongestionSetWatch(srv
,client_name
,high_water
,low_water
,watch_status
) T_IPC_SRVsrv
; T_STRclient_name
; T_INT4high_water
; T_INT4low_water
; T_BOOLwatch_status
;
srv
connection handle to RTserver
client_name
name of the RTclient to set watch status for
high_water
the number of pending bytes that must be in the 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 TipcSrvMonClientCongestionSetWatch fails, it returns FALSE
and sets the global SmartSockets error number to:
TipcSrvMonClientCongestionSetWatch starts or stops the watch of the write buffer in the client_name
RTclient. The client_name
argument can be the unique subject name of a single RTclient, a wildcarded subject name to match many RTclients, or T_IPC_MON_ALL to watch all RTclients in the project that match the value of the Monitor_Scope option. The srv
argument indicates the connection on which the watch is to be set.
TipcSrvMonClientCongestionSetWatch saves the watch status and sends a MON_CLIENT_CONGESTION_SET_WATCH message to the RTserver. The watch status controls whether the RTclient receives a MON_CLIENT_CONGESTION_STATUS message when the number of bytes in the watched RTclient's write buffer passes the high_water
or low_water
threshold. When the write buffer reaches the value of high_water
, the RTserver sends a MON_CLIENT_CONGESTION_STATUS message. The next MON_CLIENT_CONGESTION_STATUS message is sent when the number of bytes in the write buffer decreases to the low_water
number.
If watch_status
is FALSE
, the values in high_water
and low_water
are ignored.
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_CLIENT_CONGESTION_STATUS message contains five fields:
high_water
or low_water
number)client_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_CLIENT_CONGESTION_STATUS message until number of pending bytes in the buffer decreases to the low_water
number.
TipcSrvMonClientCongestionSetWatch sends a MON_CLIENT_CONGESTION_SET_WATCH message to RTserver, but does not explicitly flush the message. See TipcSrvConnGetAutoFlushSize for more information on message buffering.
RTclient write buffer congestion can only be watched, not polled.
TipcSrvMonClientBufferGetWatch, TipcSrvMonClientCongestionGetWatch, TipcSrvMonServerCongestionSetWatch, TipcSrvMonServerCongestionGetWatch
This example uses TipcSrvMonClientCongestionSetWatch to start watching buffer congestion in the primary_rtie
RTclient with a high_water
threshold of 8 million bytes and a low_water
threshold of 2 million bytes, and creates a callback to process the incoming MON_CLIENT_CONGESTION_STATUS messages:
/* =============================================================== */
/*..process_mon_client_congestion_status – process a
MON_CLIENT_CONGESTION_STATUS message */
void process_mon_client_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 client_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, &client_name, T_IPC_FT_BOOL, &high_water, NULL)) {return
; /* error */
} TutOut("Got CLIENT_CONGESTION status.\n"); TutOut("Crossed %s water threshold.\n", high_water ? "high" : "low"); TutOut("RTclient name = %s\n", client_name); TutOut("buffer size = %d\n", size); TutOut("threshold = %d\n", threshold); }/* process_mon_client_congestion_status */
/* =============================================================== */
/*...code from calling function is below */
T_IPC_MT mt;/* send the poll request out to RTserver */
if (!TipcSrvMonClientCongestionSetWatch (srv, "primary_rtie", 8000000, 2000000, TRUE)) {return
; /* error */
} mt = TipcMtLookupByNum(T_MT_MON_CLIENT_CONGESTION_STATUS); if (mt == NULL) {return
; /* error */
} if (TipcSrvConnProcessCbCreate(srv, mt, process_mon_client_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 |