TipcSrvMsgWrite


Name

TipcSrvMsgWrite — construct a message and send it through the connection to RTserver

Synopsis

T_BOOL TipcSrvMsgWrite(dest, mt, check_server_msg_send, ...) 
T_STR dest; 
T_IPC_MT mt; 
T_BOOL check_server_msg_send; 

Arguments

dest — destination subject for message

mt — message type to use for message

check_server_msg_send — whether or not to check the option Server_Msg_Send first

additional arguments — null-terminated field type-value pairs

Return Values

TRUE if the message was successfully constructed and sent, FALSE otherwise.

Diagnostics

If TipcSrvMsgWrite fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TipcSrvMsgWrite is a convenience function that takes a null-terminated variable number of field type-value pairs. The field type part of the pair is T_IPC_FT, and the value part of the pair corresponds to the arguments for the related TipcMsgAppend* function (if the type part is T_IPC_FT_REAL8, then the value part is a REAL8 number) or TipcMsgSet* function (if the type part is T_IPC_PROP_DELIVERY_MODE, then the value part is a T_IPC_DELIVERY_MODE setting). Some field types, such as arrays, use two arguments for the value part.

TipcSrvMsgWrite performs these steps:

  1. Create a message of type mt
  1. Append the fields to the message
  2. Set the message sender to the value of the option Unique_Subject
  3. Set the message destination to dest
  4. Send the message with TipcSrvMsgSend
  5. Destroy the message with TipcMsgDestroy

TipcSrvMsgWrite is a short wrapper function that calls TipcSrvMsgWriteVa.

If check_server_msg_send is TRUE and the option Server_Msg_Send is FALSE, then TipcSrvMsgWrite does not send the message, but returns TRUE immediately. For normal usage, check_server_msg_send should always be TRUE. This allows the user to globally turn off all normal outgoing messages by setting the option Server_Msg_Send to FALSE. This is useful for running two RTclients, the primary one with Server_Msg_Send set to TRUE and the backup one with Server_Msg_Send set to FALSE.

TipcSrvMsgWrite may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvMsgWrite buffers the message as if the RTclient were still connected to RTserver. See TipcSrvCreate on automatic creation of connections and warm connections to RTserver.

Caution

None

See Also

TipcConnMsgWrite, TipcSrvMsgSend, TipcSrvMsgWriteVa

Examples

This example constructs and sends a NUMERIC_DATA message with TipcSrvMsgWrite:

T_IPC_MT mt; 
 
mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); 
if (mt == NULL) { 
  return;  /* error */ 
}  
 
if (!TipcSrvMsgWrite("/primary/control", mt, TRUE, 
                     T_IPC_FT_STR, "voltage1", 
                     T_IPC_FT_REAL8, 65.0, 
                     T_IPC_FT_STR, "current1", 
                     T_IPC_FT_REAL8, 10.335, 
                     NULL)) { 
  return;  /* error */ 
}  

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com