#the Communication Protocol Specificion 3.0
Introduction
The byte order of integer in request and response is big endian.
Details
The Magic Word Flag means
- Write(CUD) Flag: the 4th bit on: 0x08 = 0000 1000
- Read(G) Flag: the 4th bit off
- Async flag: the 3rd bit on: 0x04 = 0000 0100
- Column Flag: the 1st bit on: 0x01
- Row Flag: the 1st bit off
- Command flag: 0xC0 = 1100 0000
Write Operation:
- Create(Insert): 1
- Put: 2
- PutCat(append a new field in a row): 3
- Delete: 4
Read Operation:
Column Put: 列写
Request:
MagicWord(Byte): 0xC9
Command(Word): 0xC9 0x02
total size (4bytes) = 1 + 2 + 2 + 4 + tableSize + keySize + valueSize //added
table size(1byte)
table buffer
key size(2bytes)
key buffer
field size(2bytes)
field buffer
value size(4bytes)
value buffer
Response: (1byte)
An 8-bit integer whose value is 0 on success or another on failureRow Put: 行写
Request:
MagicWord(Byte): 0xC8
Command(Word): 0xC8 0x02
total size (4bytes) = 1 + 2 + 4 + 2*(fieldCount+1) + keySize + fieldSize + for (i=1,i<fieldCount,i++) {fieldSize+} + valueSize //added
table size(1byte)
table buffer
key size(2bytes)
key buffer
Field Count(4 bytes)
field1 size(2bytes)
field1 buffer
field2 size(2bytes)
...
fieldN size(2bytes)
value1 size(4bytes)
value2 size(4bytes)
table buffer
key buffer
field1 buffer
field2 buffer
....
fieldN buffer
value1 buffer
value2 buffer
...
Response: (1byte)
An 8-bit integer whose value is 0 on success or another on failure