Header is present in response and request messages between Zabbix components. It is required to determine the length of message. The header consists of:
<PROTOCOL> - "ZBXD" (4 bytes). <FLAGS> -the protocol flags, (1 byte). 0x01 - Zabbix communications protocol, 0x02 - compression). <DATALEN> - data length (4 bytes). 1 will be formatted as 01/00/00/00 (four bytes, 32 bit number in little-endian format). <RESERVED> - reserved for protocol extensions (4 bytes).
When compression is enabled (0x02 flag) the <RESERVED> bytes contains uncompressed data size, 32 bit number in little-endian format.
To not exhaust memory (potentially) Zabbix protocol is limited to accept only 128MB in one connection.
Here are code snippets showing how to add Zabbix protocol header to the
data you want to send in order to obtain
packet you should send to Zabbix so it is interpreted correctly.