TipcMsgNextBinary


Name

TipcMsgNextBinary — get a BINARY field from a message

Synopsis

T_BOOL TipcMsgNextBinary(msg, binary_return, size_return) 
T_IPC_MSG msg; 
T_PTR *binary_return; 
T_INT4 *size_return; 

Arguments

msg — message to get field from

binary_return — storage for BINARY value from field

size_return — storage for number of bytes in BINARY field

Return Values

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

Diagnostics

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

Description

TipcMsgNextBinary retrieves the value of the current field of a message, which must be a BINARY (arbitrary binary data) field. If TipcMsgNextBinary succeeds, it advances the current field to the next field in the message.

Caution

If TipcMsgNextBinary returns FALSE, it does not store values in binary_return and size_return.

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

See Also

TipcMsgAppendBinary, TipcMsgAppendBinaryPtr

Examples

This example reads a BINARY image field from a message and prints the hex representation of the binary data:

/* pointers to arrays are a little tricky in C */ 
char (*image)[1024]; /* fixed size image */ 
T_INT4 image_size; 
T_INT4 i; 
T_INT4 j; 
 
if (!TipcMsgNextBinary(msg, &image, &image_size)) { 
  return;  /* error */ 
}  
 
/* image_size had better be 1024x1024! */ 
TutOut("image_size = %d\n", image_size); 
 
for (i = 0; i < 1024; i++) { 
  for (j = 0; j < 1024; j++) { 
    TutOut("image[%d][%d] = %x\n", i, j, image[i][j]); 
  } 
} 

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