TipcMsgCreate create a new message
mt
message type
New message if successful, NULL
otherwise.
If TipcMsgCreate fails, it returns NULL
and sets the global SmartSockets error number to:
TipcMsgCreate creates a new message with the desired type, with these properties:
NULL
, a destination property of NULL
, zero fields (that is, the data property is empty), and a reference count of 1
. When the message returned by TipcMsgCreate is no longer needed, destroy it by calling TipcMsgDestroy, unless the message is passed to another function which takes responsibility for destroying the message, such as TipcSrvMsgInsert.
This example creates a message, appends two fields, 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 (!TipcMsgAppendStrReal8(msg, "speed_limit", 55.0)) {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 |