TipcMonClientCongestionSetWatch


Name

TipcMonClientCongestionSetWatch — start or stop watching for congestion in an RTclient’s write buffer

Synopsis

T_BOOL TipcMonClientCongestionSetWatch(client_name, high_water, low_water, 
watch_status) 
T_STR client_name; 
T_INT4 high_water; 
T_INT4 low_water; 
T_BOOL watch_status; 

Arguments

client_name — name of the RTclient to set the watch status for

high_water — the number of pending bytes that must be exceeded 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)

Return Values

TRUE if the watch status was successfully set, FALSE otherwise.

Diagnostics

If TipcMonClientCongestionSetWatch fails, it returns FALSE and sets the global SmartSockets error number to:

Description

TipcMonClientCongestionSetWatch 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.

TipcMonClientCongestionSetWatch saves the watch status and sends a MON_CLIENT_CONGESTION_SET_WATCH message to client_name. 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 reaches the high_water or low_water threshold. When the write buffer passes 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:

Once the number of bytes in the write buffer has passed 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.

Caution

TipcMonClientCongestionSetWatch sends a MON_CLIENT_CONGESTION_SET_WATCH message to RTserver, but does not explicitly flush the message. See TipcSrvGetAutoFlushSize for more information on message buffering.

RTclient write buffer congestion can only be watched, not polled.

See Also

TipcMonClientBufferGetWatch, TipcMonClientCongestionGetWatch TipcMonServerCongestionSetWatch, TipcMonServerCongestionGetWatch

Examples

This example uses TipcMonClientCongestionSetWatch 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 (!TipcMonClientCongestionSetWatch ("primary_rtie", 8000000, 
2000000,  
                                      TRUE)) { 
  return;  /* error */ 
} 
 
mt = TipcMtLookupByNum(T_MT_MON_CLIENT_CONGESTION_STATUS); 
if (mt == NULL) { 
  return;  /* error */ 
} 
 
if (TipcSrvProcessCbCreate(mt, 
process_mon_client_congestion_status, 
                           NULL) == NULL) { 
  return;  /* error */ 
} 
 
/* At this point TipcSrvMainLoop 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