Message separating

Imported from previous forum

Can someone please profide me with information on how messages are separated from one another? The Fix documentation mentions SOH characters between groups, but I can’t find mention of something delimiting whole messages. Without this mechanism, I’d have to read from the socket until I see a header, then look in the header to see how long the whole message is, then use that many bytes plus the extra at the end to know where the message ends.

Thanks

[ original email was from Ryan Pierce - rpierce@taltrade.com ]
> Can someone please profide me with information on how messages are separated from one another? The Fix documentation mentions SOH characters between groups, but I can’t find mention of something delimiting whole messages. Without this mechanism, I’d have to read from the socket until I see a header, then look in the header to see how long the whole message is, then use that many bytes plus the extra at the end to know where the message ends.

FIX messages each include a BodyLength tag, which tells you how much farther into the buffer you must read to get to the checksum. It does not include the SOH after the BodyLength field, but does include the SOH prior to Checksum. The Checksum is a fixed length field (the value of it is zero-padded to 3 characters) so you know how much farther to read. After Checksum comes a single SOH and the next FIX message starts.

One thing you may find is that not all firms compute and send body length properly. This happens because not all engines enforce a check on body length (i.e. consider a FIX message concluded when they see the start of the next one, regardless of BodyLength), hence depending on their trading partners, they can get away with it.