Galaxy Communicator Documentation:

Binary Data

License / Documentation home / Help and feedback

In addition to brokering, MIT provides a way of moving binary data among servers, using the binary frame object. We can use this object either to send around audio data, or to encode arbitrary structures which remain opaque to the Communicator Hub. (Be aware that unlike brokering connections, big_endian/little_endian issues are not addressed in the binary data tools, since only 8 bit binary data can be encoded.)

We provide an example of using binary objects for audio to compare with our example of using brokering for audio. In this section, we show how one might use binary objects to encode arbitrary structures.

Passing arbitrary data

The key aspect of using binary objects to encode arbitrary data is to write encoding and decoding functions for the data. In the example we provide, we encode and decode a simple structure, whose slots are initialized in the reinitialize() message: The important step here is for the server or servers which need access to this arbitrary data to agree on a binary (or string) encoding of the data. The data will be passed untouched. In our example, the reinitialize() message creates a structure, encodes it, and passes it to the Hub, and the receive_binary() message decodes the data, recreates the structure, and prints out the contents of the structure: Note how the data and size established by the encoder are used to create a binary object, and then how the data and size in the binary object are passed to the decoder to recreate the structure. In this way, data structures which the Hub knows nothing about can be passed between servers without needing to recursively duplicate the structure of the data in frames.
License / Documentation home / Help and feedback
Last updated October 10, 1999