TipcSrvConnMsgWrite


Name

TipcSrvConnMsgWrite — construct a message and send it through the connection

Synopsis

T_BOOL TipcSrvConnMsgWrite(srv, dest, mt, check_server_msg_send, ...) 
T_IPC_SRV srv; 
T_STR dest; 
T_IPC_MT mt; 
T_BOOL check_server_msg_send; 

Arguments

srv — connection handle to RTserver

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 TipcSrvConnMsgWrite fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

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

TipcSrvConnMsgWrite 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 TipcSrvConnMsgSend on connection srv
  5. Destroy the message with TipcMsgDestroy

TipcSrvConnMsgWrite is a short wrapper function that calls TipcSrvConnMsgWriteVa.

If check_server_msg_send is TRUE and the option Server_Msg_Send is FALSE, then TipcSrvConnMsgWrite 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.

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

Caution

None

See Also

TipcConnMsgWrite, TipcSrvConnMsgSend, TipcSrvConnMsgWriteVa

Examples

This example constructs and sends a NUMERIC_DATA message with TipcSrvConnMsgWrite:

T_IPC_MT mt; 
 
mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); 
if (mt == NULL) { 
  return;  /* error */ 
}  
 
if (!TipcSrvConnMsgWrite(srv, "/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