Áú»¢¶Ä²©

This is the documentation page for an unsupported version of Áú»¢¶Ä²©.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

4 Header and data length

Overview

Header and data length are present in response and request messages between Áú»¢¶Ä²© components. It is required to determine the length of message.

<HEADER> - "ZBXD\x01" (5 bytes)
       <DATALEN> - data length (8 bytes). 1 will be formatted as 01/00/00/00/00/00/00/00 (eight bytes, 64 bit number in little-endian format)

To not exhaust memory (potentially) Áú»¢¶Ä²© protocol is limited to accept only 128MB in one connection.

Implementation

Here are code snippets showing how to add Áú»¢¶Ä²© protocol header to the data you want to send in order to obtain packet you should send to Áú»¢¶Ä²© so it is interpreted correctly.

Language Code
bash printf -v LENGTH '%016x' "${#DATA}"PACK=""for i in {14..0..-2}; do PACK="$PACK\\x${LENGTH:$i:2}"; doneprintf "ZBXD\1$PACK%s" $DATA
Java byte[] header = new byte[] {'Z', 'B', 'X', 'D', '\1',(byte)(data.length & 0xFF),(byte)((data.length >> 8) & 0xFF),(byte)((data.length >> 16) & 0xFF),(byte)((data.length >> 24) & 0xFF),'\0', '\0', '\0', '\0'};| |<|byte[] packet = new byte[header.length + data.length];System.arraycopy(header, 0, packet, 0, header.length);System.arraycopy(data, 0, packet, header.length, data.length);
PHP $packet = "ZBXD\1" . pack('P', strlen($data)) . $data;or$packet = "ZBXD\1" . pack('V', strlen($data)) . "\0\0\0\0" . $data;
Perl my $packet = "ZBXD\1" . pack('<Q', length($data)) . $data;ormy $packet = "ZBXD\1" . pack('V', length($data)) . "\0\0\0\0" . $data;
Python packet = "ZBXD\1" + struct.pack('<Q', len(data)) + data