Should I use a byte array to send a message of a specific format containing different pieces of information?
<p>I am working on a program that will be converting information from an xml like file/string (but has no nesting and is almost always the same order unless something goes wrong) into a message to be sent t, will not contain routing information (so not a datagram), and will use sockets.  </p>

<p>The message will have different kinds of data, containing 32 bit unsigned ints, 32 bit reals, 64 bit reals, 64 bit unsigned ints, and 16 bit unsigned ints.  The first 16 bytes of the message serve as the header (similar to a datagram, but without routing information), and will contain information such as message type and message size. </p>

<p>The message will contain data on atleast 10 observations and parameters to use in what ever decisions to make using data.  </p>

<p>I originally was going to send the message as a datagram until I realized that the message would not have any routing information. </p>

<p>The system uses point to point communication, and both elements know where to send their data.  </p>

<p>Since this is not a datagram, and the message has a maximum size of 1888 bytes size, with different bytes containing different information, should I use a byte array to store and send the different pieces of data in one message?</p>

<p>EDIT:  Here is a sample of what the message structure is like.</p>

<p>Bytes 0 to 15  : Message header containing Message type(bytes 4-7) and message size(12-15) and other stuff, all 32 bit unsigned ints, except for bytes 8 to 11(reserved for unused).</p>

<p>Bytes 24 to 25 : Chunk number , usigned 16 bit integer.</p>

<p>Bytes 128-131 :  Point of Origin Data relative to system, Real 32</p>

<p>Also, just to further clarify, this is using Java to send a message from a radar computer to another computer.</p>