TipcMsgClone make an identical copy of a message
msg
message to copy
Copy of original message if successful, NULL
otherwise.
If TipcMsgClone fails, it returns NULL
and sets the global SmartSockets error number to one of:
TipcMsgClone makes a copy of a message. A new message is created, and all properties of the original message are copied to the new message. The copy does not share any memory with the original message. The copy is not marked read-only, even if the original message is.
When the message returned by TipcMsgClone 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, makes a copy of the original message, and destroys the original message:
T_IPC_MT mt; T_IPC_MSG src; T_IPC_MSG dest; mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); if (mt == NULL) {return
; /* error */
} src = TipcMsgCreate(mt); if (src == NULL) {return
; /* error */
} if (!TipcMsgAppendStrReal8(src, "speed_limit", 55.0)) {return
; /* error */
} dest = TipcMsgClone(src); if (dest == NULL) {return
; /* error */
} if (!TipcMsgDestroy(src)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |