TipcMsgNextInt2


Name

TipcMsgNextInt2 — get an INT2 field from a message

Synopsis

T_BOOL TipcMsgNextInt2(msg, int2_return) 
T_IPC_MSG msg; 
T_INT2 *int2_return; 

Arguments

msg — message to get field from

int2_return — storage for INT2 value from field

Return Values

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

Diagnostics

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

Description

TipcMsgNextInt2 retrieves the value of the current field of a message, which must be an INT2 (two-byte integer) field. If TipcMsgNextInt2 succeeds, it advances the current field to the next field in the message.

TipcMsgNextInt2 converts the field into the data format used by this process if necessary.

Caution

If TipcMsgNextInt2 returns FALSE, it does not store a value in int2_return.

See Also

TipcMsgAppendInt2

Examples

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

T_IPC_MT mt; 
T_IPC_MSG msg; 
T_INT2 int2_val; 
 
#define USER_MT_INT2_TEST 100 
mt = TipcMtCreate("int2_test", USER_MT_INT2_TEST, "int2"); 
if (mt == NULL) { 
  return;  /* error */ 
} 
 
msg = TipcMsgCreate(mt); 
if (msg == NULL) { 
  return;  /* error */ 
} 
 
if (!TipcMsgAppendInt2(msg, 42)) { 
  return;  /* error */ 
}  
if (!TipcMsgSetCurrent(msg, 0)) { 
  return;  /* error */ 
}  
if (!TipcMsgNextInt2(msg, &int2_val)) { 
  return;  /* error */ 
}  
TutOut("int2_val == %d\n", int2_val); 

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