Imported from previous forum
[ original email was from Maria Ischuk - mbb@orcsoftware.com ]
Hi All,
I am beginner in FIX Protocol and it’s maybe silly question but I don’t understand.
Why do I place BodyLength in start of my message? It is very uncomfortable for me.I have to compute BodyLength at first and then allocate memory and pack my message. It is comfortable for me that message has predefined length or at least field BodyLength is in end of my message. Am I wrong?
Thanks, Maria.
You need to think of it from the receiver’s end. BodyLength is at the front to facilitate the receiver reading and then parsing the message you have sent. I don’t think it has any direct correlation re: your memory allocation. You simply have to construct the rest of the message, allocating memory and constructing it as you wish and then compute the length of it and populate BodyLength. How much memory you need to allocate and the techinques for doing so will be a function of what you need to send not whether BodyLength appears at the front or end of the message.
FIX messages can have varying lengths vs. a single pre-defined length. This is an important feature for flexibility and bandwidth utilization.
> Hi All,
>
> I am beginner in FIX Protocol and it’s maybe silly question but I don’t understand.
>
> Why do I place BodyLength in start of my message? It is very uncomfortable for me.I have to compute BodyLength at first and then allocate memory and pack my message. It is comfortable for me that message has predefined length or at least field BodyLength is in end of my message. Am I wrong?
>
> Thanks, Maria.
>
>
>