TipcMsgClone


Name

TipcMsgClone — make an identical copy of a message

Synopsis

T_IPC_MSG TipcMsgClone(msg) 
T_IPC_MSG msg; 

Arguments

msg — message to copy

Return Values

Copy of original message if successful, NULL otherwise.

Diagnostics

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

Description

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.

Caution

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

See Also

TipcMsgCreate, TipcMsgDestroy

Examples

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