could you encapsulate writing a message together with its 4 byte size header please