TipcMsgWrite


Name

TipcMsgWrite — append fields to a message

Synopsis

T_BOOL TipcMsgWrite(msg, ...) 
T_IPC_MSG msg; 

Arguments

msg — message to append fields to

additional arguments — null-terminated field type-value pairs

Return Values

TRUE if all the fields were successfully appended, FALSE otherwise.

Diagnostics

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

Description

TipcMsgWrite is a convenience function that takes a null-terminated variable number of field type-value pairs and appends these fields to the message. The field type part of the pair is a T_IPC_FT, and the value part of the pair corresponds to the argument(s) for the related TipcMsgAppend* function (for example, if the type part is T_IPC_FT_REAL8, then the value part is a REAL8 number) or TipcMsgSet* function (for example, if the type part is T_IPC_PROP_DELIVERY_MODE, then the value part is a T_IPC_DELIVERY_MODE setting).

TipcMsgWrite is a short wrapper function that calls TipcMsgWriteVa.

Caution

The last argument passed to TipcMsgWrite must be null; otherwise TipcMsgWrite may append garbage fields to the message. Using TipcMsgWrite is slightly slower than using the TipcMsgAppend* functions directly.

TipcMsgWrite does not send a message: it only appends fields to a message.

See Also

TipcMsgRead, TipcMsgWriteVa

Examples

This example creates a message, appends two fields with TipcMsgWrite, and destroys the message:

T_IPC_MT mt; 
T_IPC_MSG msg; 
 
mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); 
if (mt == NULL) { 
  return;  /* error */ 
}  
 
msg = TipcMsgCreate(mt); 
if (msg == NULL) { 
  return;  /* error */ 
}  
 
/* An RTclient would typically set the destination of */ 
/* a message at this point by calling TipcMsgSetDest. */ 
 
if (!TipcMsgWrite(msg,  
                  T_IPC_FT_STR, "speed_limit",  
                  T_IPC_FT_REAL8, 55.0, 
                  NULL)) { 
  return;  /* error */ 
}  
 
/* A process would typically send a message at this point by */ 
/* calling TipcConnMsgSend or TipcSrvMsgSend. */ 
 
if (!TipcMsgDestroy(msg)) { 
  return;  /* error */ 
}  

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