TipcMsgNextMsg


Name

TipcMsgNextMsg — get a MSG field from a message

Synopsis

T_BOOL TipcMsgNextMsg(msg, msg_return) 
T_IPC_MSG msg; 
T_IPC_MSG *msg_return; 

Arguments

msg — message to get field from

msg_return — storage for MSG value from field

Return Values

TRUE if the field was successfully retrieved from the message, FALSE otherwise.

Diagnostics

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

Description

TipcMsgNextMsg retrieves the value of the current field of a message, which must be a MSG field. If TipcMsgNextMsg succeeds, it advances the current field to the next field in the message.

TipcMsgNextMsg converts the field into the data formats used by this process if necessary.

Caution

If TipcMsgNextMsg returns FALSE, it does not store a value in msg_return.

Do not modify the value stored in msg_return. It points directly into an internal data structure.

See Also

TipcMsgAppendMsg, TipcMsgAppendMsgPtr

Examples

This example creates a message, appends a MSG field, and reads the field back from the message:

T_IPC_MT mt; 
T_IPC_MSG msg; 
T_IPC_MSG msg_val; 
 
#define USER_MT_CONTAINER 100 
mt = TipcMtCreate("container", USER_MT_CONTAINER, "msg"); 
if (mt == NULL) { 
  return;  /* error */ 
}  
msg = TipcMsgCreate(mt); 
if (msg == NULL) { 
  return;  /* error */ 
}  
 
mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); 
if (mt == NULL) { 
  return;  /* error */ 
}  
msg_val = TipcMsgCreate(mt); 
if (msg_val == NULL) { 
  return;  /* error */ 
}  
 
if (!TipcMsgAppendStrReal8(msg_val, "speed_limit", 55.0)) { 
  return;  /* error */ 
}  
if (!TipcMsgAppendMsg(msg, msg_val)) { 
  return;  /* error */ 
}  
if (!TipcMsgDestroy(msg_val)) { 
  return;  /* error */ 
}  
msg_val = NULL; 
 
if (!TipcMsgSetCurrent(msg, 0)) { 
  return;  /* error */ 
}  
if (!TipcMsgNextMsg(msg, &msg_val)) { 
  return;  /* error */ 
}  
 
if (!TipcMsgPrint(msg_val, TutOut)) { 
  return;  /* error */ 
} 

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