WebSphere Message Service Clients for C/C++ and .NET, Version 1.2 Operating Systems: Linux, Windows

Bytes messages

The body of a bytes message contains a stream of bytes. The body contains no data names or data type information, only the actual data, and it is entirely the responsibility of the sending and receiving applications to interpret this data.

Bytes messages are particularly useful if an XMS application needs to exchange messages with applications that are not using the XMS or JMS application programming interface.

After an application creates a bytes message, the body of the message is write-only. The application assembles the application data into the body by calling the appropriate write methods of the BytesMessage class for C or C++, or of the IBytesMessage interface for .NET. Each time the application writes a value to the bytes message stream, the value is assembled immediately after the previous value written by the application. XMS maintains an internal cursor to remember the position of the last byte that was assembled.

When the application sends the message, the body of the message becomes read-only. In this mode, the application can send the message multiple times.

When an application receives a bytes message, the body of the message is read-only. The application can use the appropriate read methods of the BytesMessage class or IBytesMessage interface to read the contents of the bytes message stream. The application reads the bytes in sequence, and XMS maintains an internal cursor to remember the position of the last byte that was read.

In the case of C only, an application can skip over bytes without reading them by calling a read function with a null pointer for the value parameter, or for the buffer parameter if the application calls xmsBytesMsgReadBytes(). For information about how to skip over a string, see xmsBytesMsgReadUTF – Read UTF String.

If an application calls the Reset method of the BytesMessage class or IBytesMessage interface when the body of a bytes message is write-only, the body becomes read-only. The method also repositions the cursor at the beginning of the bytes message stream.

If an application calls the Clear Body method of the Message class for C or C++ or of the IMessage interface for .NET when the body of a bytes message is read-only, the body becomes write-only. The method also clears the body.

Related concepts
Map messages
Object messages
Stream messages
Text messages
Related reference
BytesMessage (for the C class)
BytesMessage (for the C++ class)
IBytesMessage (for the .NET interface)

Concept topic

Terms of Use | Feedback

Last updated: 11 Nov 2005

© Copyright IBM Corporation 2005. All Rights Reserved.