Thrift Tcompactprotocol Compact Binary Protocol Analysis

Source: Internet
Author: User
Tags compact



Thrift's Compact Transport Protocol Analysis:



Use a picture to illustrate how each data type is represented in the tcompactprotocol of thrift.









Message Format code:



type bool:



A single byte.



If the bool Type field is a member field of a struct or message and has a number, the high 4 bits of a byte represent the field number, and the lower 4 bits represent the value of bool (0001:true, 0010:false), which is the low 4-bit value of one byte (True:1,false:2).



If the bool Type field exists individually, one byte represents the value, that is: the value of one byte (True:1,false:2).



Byte Type:



The number of a byte is combined with the type (high 4-bit number offset 1, low 4-bit type), and a byte value.



I16 Type:



A byte number is combined with a type (high 4-bit number offset 1, low 4-bit type), and a value of one to three bytes.



I32 Type:



A byte number is combined with a type (high 4-bit number offset 1, low 4-bit type), and a value of one to five bytes.



I64 Type:



A byte number is combined with a type (high 4-bit number offset 1, low 4-bit type), and a value of one to 10 bytes.



Double class type:



  A byte number is combined with a type (high 4-bit number offset 1, low 4-bit type), and a eight-byte value.



  Note: Convert the double type of data to eight bytes and send it in a small-ended way.



String Type:



A byte number is combined with a type (high 4-bit number offset 1, low 4-bit type), one to five bytes of payload data length, and load data.



Struct class type:



A byte number is combined with a type (high 4-bit number offset 1, low 4-bit type), struct payload data, and a byte end tag.



MAP Type:



A byte number and type combination (high 4-bit number offset 1, low 4-bit type), number of map elements from one to five bytes, a combination of key value types of one byte (high 4-bit key type, low 4-bit value type), map payload data.



Set class type:



Representation one: A byte number and type combination (high 4-bit number offset 1, low 4-bit type), the number of elements of a byte and value type combination (high 4-bit key element number, low 4-bit value type), set load data.



Applies to cases where the number of elements in a set is less than or equal to 14.



Expression two: A byte number and type combination (high 4 bit number offset 1, low 4-bit type), a byte of the key value type (high 4 bits are all 1, low 4-bit value type), one to five bytes of the number of map elements, set load data.



Applies to cases where the number of elements in a set is greater than 14.



List class type:



  representation One: a byte number and type combination (high 4-bit number offset 1, low 4-bit type), one-byte element number and value type combination (high 4-bit key element number, low 4-bit value type), List payload data.



Applies to cases where the number of elements in a set is less than or equal to 14.



  expression two: a byte number and type combination (high 4 bit number offset 1, low 4-bit type), a byte of the key value type (high 4 bits are all 1, low 4-bit value type), one to five bytes of the number of MAP elements, list load data.



Applies to cases where the number of elements in a set is greater than 14.



Message (function) type:



One byte version, one byte of message invocation (Request: 0x21, Response: 0x41, Exception: 0X61,ONEWAY:0X81), one to five bytes of message name length, message name, message parameter payload data, one byte end tag.



The above description is based on the case that the number of adjacent fields is less than or equal to 15.



If the field adjacent number is greater than 15, the type and number need to be represented separately: one byte for the type and one to five bytes for the number offset value.






Reading here, it may be doubtful why the value of numeric values is expressed as "one to five bytes"?



Reason: Compression of the numerical value, compression algorithm is varint, the following simple explanation of what is varint numerical compression.



Varint Numeric compression



An integer is typically expressed as a 32-bit, and the storage requires 4 bytes.



If the integer size is less than 256, then only one byte is needed to store the integer, so that the remaining 3 bytes of storage space are idle.



If the integer size is between 256 and 65536, then only two bytes are required to store the integer, so that the remaining 2 bytes of storage space are idle.



If the integer size is between 65536 and 16777216, then only three bytes are required to store the integer, so that the remaining 1 bytes of storage space are idle.



If the integer size is between 16777216 and 4294967296, then the integer must be stored in four bytes.



At this point, Google introduced the Varint, the free space representing the integer compression, with this idea to serialize integers.



This compact method of representing numbers. It uses one or more bytes to represent a number, and the smaller the number, the smaller the number of bytes.



Varint the number in 7-bit segments, compressing an integer and storing it.






The highest bit of each byte in the varint has a special meaning, if the bit is 1, the subsequent byte is also part of the number, and if the bit is 0, the end.



The other 7 bits are used to represent numbers. Therefore, a number less than 128 can be represented by a byte. A number greater than 128 will use two bytes.






This allows for numeric compression.



With Varint, for a small number of int32 types, it can be represented by 1 bytes. Of course everything has good and bad side, using varint notation, large numbers need 5 byte to represent.



From a statistical point of view, generally not all of the numbers in the message are large numbers, so in most cases, with varint, you can use a smaller number of bytes to represent the digital information.



Implement the Varint32 code:


uint32_t TCompactProtocolT<Transport_>::writeVarint32(uint32_t n) {
  uint8_t buf[5];
  uint32_t wsize = 0;

  while (true) {
    if ((n & ~0x7F) == 0) {
      buf[wsize++] = (int8_t)n;
      break;
    } else {
      buf[wsize++] = (int8_t)((n & 0x7F) | 0x80);
      n >>= 7;
    }
  }
  trans_->write(buf, wsize);
  return wsize;
}


Implement the Varint64 code in the same way:


uint32_t TCompactProtocolT<Transport_>::writeVarint64(uint64_t n) {
  uint8_t buf[10];
  uint32_t wsize = 0;

  while (true) {
    if ((n & ~0x7FL) == 0) {
      buf[wsize++] = (int8_t)n;
      break;
    } else {
      buf[wsize++] = (int8_t)((n & 0x7F) | 0x80);
      n >>= 7;
    }
  }
  trans_->write(buf, wsize);
  return wsize;
}





Perhaps you would doubt if an integer is the highest and the lower is 1, which means the negative number with varint how to compress?



Since positive numbers can be varint very good compression, can you convert negative numbers to positive numbers and then use Varint to do numerical compression?



The answer is: yes.



How to turn negative numbers into positive numbers:



Introduce an algorithm called Zigzag, so what is zigzag?



Zigzag algorithm



Positive numbers: Multiply the current number by 2, zigzagy = x * 2



Negative numbers: Current number multiplied by-2 minus 1, zigzagy = x *-2-1



The shift in the program means:




The code indicates:


/**
 * Convert l into a zigzag long. This allows negative numbers to be
 * represented compactly as a varint.
 */
template <class Transport_>
uint64_t TCompactProtocolT<Transport_>::i64ToZigzag(const int64_t l) {
  return (l << 1) ^ (l >> 63);
}

/**
 * Convert n into a zigzag int. This allows negative numbers to be
 * represented compactly as a varint.
 */
template <class Transport_>
uint32_t TCompactProtocolT<Transport_>::i32ToZigzag(const int32_t n) {
  return (n << 1) ^ (n >> 31);
}





Thrift the value of the sending procedure is: first do zigzag get a number, and then do varint value compression.



Here is an example to illustrate the Thrift Tcompactprotocol protocol.



Build a rpc.thrift IDL file.


namespace go demo.rpc
namespace cpp demo.rpc
struct ArgStruct {
    1:byte argByte,
    2:string argString
    3:i16  argI16,
    4:i32  argI32,
    5:i64  argI64,
    6:double argDouble,

}

service RpcService {
    list<string> funCall(
        1:ArgStruct argStruct,
        2:byte argByte,
        3:i16  argI16,
        4:i32  argI32,
        5:i64  argI64,
        6:double argDouble,
        7:string argString,
        8:map<string, string> paramMapStrStr,
        9:map<i32, string> paramMapI32Str,
        10:set<string> paramSetStr,
        11:set<i64> paramSetI64,
        12:list<string> paramListStr,
        ),
}


Using commands to generate go code


Thrift--gen go-o src rpc.thrift


Write a Go Thrift client:


package main

import (
    "demo/rpc"
    "fmt"
    "git.apache.org/thrift.git/lib/go/thrift"
    "net"
    "os"
    "time"
)

func main() {
    startTime := currentTimeMillis()
    //transportFactory := thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory())
    transportFactory := thrift.NewTTransportFactory()
    //protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
    //protocolFactory := thrift.NewTJSONProtocolFactory()
    //protocolFactory := thrift.NewTSimpleJSONProtocolFactory()
    protocolFactory := thrift.NewTCompactProtocolFactory()

    transport, err := thrift.NewTSocket(net.JoinHostPort("127.0.0.1", "8090"))
    if err != nil {
        fmt.Fprintln(os.Stderr, "error resolving address:", err)
        os.Exit(1)
    }

    useTransport := transportFactory.GetTransport(transport)
    client := rpc.NewRpcServiceClientFactory(useTransport, protocolFactory)
    if err := transport.Open(); err != nil {
        fmt.Fprintln(os.Stderr, "Error opening socket to 127.0.0.1:8090", " ", err)
        os.Exit(1)
    }
    defer transport.Close()

    argStruct := &rpc.ArgStruct{}
    argStruct.ArgByte = 53
    argStruct.ArgString = "str value"
    argStruct.ArgI16 = 54
    argStruct.ArgI32 = 12
    argStruct.ArgI64 = 43
    argStruct.ArgDouble = 11.22
    paramMap := make(map[string]string)
    paramMap["name"] = "namess"
    paramMap["pass"] = "vpass"
    paramMapI32Str := make(map[int32]string)
    paramMapI32Str[10] = "val10"
    paramMapI32Str[20] = "val20"
    paramSetStr := make(map[string]bool)
    paramSetStr["ele1"] = true
    paramSetStr["ele2"] = true
    paramSetStr["ele3"] = true
    paramSetI64 := make(map[int64]bool)
    paramSetI64[11] = true
    paramSetI64[22] = true
    paramSetI64[33] = true
    paramListStr := []string{"l1.","l2."}
    r1, e1 := client.FunCall(argStruct,
        53, 54, 12, 34, 11.22, "login",
        paramMap,paramMapI32Str,
        paramSetStr, paramSetI64, paramListStr)
    fmt.Println("Call->", r1, e1)

    endTime := currentTimeMillis()
    fmt.Println("Program exit. time->", endTime, startTime, (endTime - startTime))
}

func currentTimeMillis() int64 {
    return time.Now().UnixNano() / 1000000
}


To write a simple test go server:


package main
 
import (
    "demo/rpc"
    "fmt"
    "git.apache.org/thrift.git/lib/go/thrift"
    "os"
)
 
const (
    NetworkAddr = ":8090"
)
 
type RpcServiceImpl struct {
}
 
func (this *RpcServiceImpl) FunCall(argStruct *rpc.ArgStruct,
    argByte int8, argI16 int16, argI32 int32,
    argI64 int64, argDouble float64, argString string,
    paramMapStrStr map[string]string, paramMapI32Str map[int32]string,
    paramSetStr map[string]bool, paramSetI64 map[int64]bool,
    paramListStr []string) (r []string, err error) {
    fmt.Println("-->FunCall:", argStruct)
    r = append(r, "return 1 by FunCall.")
    r = append(r, "return 2 by FunCall.")
    return
}
 
func main() {
    //transportFactory := thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory())
    transportFactory := thrift.NewTTransportFactory()
    //protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
    protocolFactory := thrift.NewTCompactProtocolFactory()
    //protocolFactory := thrift.NewTJSONProtocolFactory()
    //protocolFactory := thrift.NewTSimpleJSONProtocolFactory()
 
    serverTransport, err := thrift.NewTServerSocket(NetworkAddr)
    if err != nil {
        fmt.Println("Error!", err)
        os.Exit(1)
    }
 
    handler := &RpcServiceImpl{}
    processor := rpc.NewRpcServiceProcessor(handler)
 
    server := thrift.NewTSimpleServer4(processor, serverTransport,transportFactory, protocolFactory)
    fmt.Println("thrift server in", NetworkAddr)
    server.Serve()
}


Go build rpcclient.go executes after the executable file rpcclient is generated.



Perform the pre-capture packet analysis.


request:
0000   82 21 01 07 66 75 6e 43 61 6c 6c 1c 13 35 18 09
0010   73 74 72 20 76 61 6c 75 65 14 6c 15 18 16 56 17
0020   71 3d 0a d7 a3 70 26 40 00 13 35 14 6c 15 18 16
0030   44 17 71 3d 0a d7 a3 70 26 40 18 05 6c 6f 67 69
0040   6e 1b 02 88 04 6e 61 6d 65 06 6e 61 6d 65 73 73
0050   04 70 61 73 73 05 76 70 61 73 73 1b 02 58 14 05
0060   76 61 6c 31 30 28 05 76 61 6c 32 30 1a 38 04 65
0070   6c 65 31 04 65 6c 65 32 04 65 6c 65 33 1a 36 16
0080   2c 42 19 28 03 6c 31 2e 03 6c 32 2e 00

响应:
0000   82 41 01 07 66 75 6e 43 61 6c 6c 09 00 28 14 72
0010   65 74 75 72 6e 20 31 20 62 79 20 46 75 6e 43 61
0020   6c 6c 2e 14 72 65 74 75 72 6e 20 32 20 62 79 20
0030   46 75 6e 43 61 6c 6c 2e 00


Starts analyzing the request data for the packet capture.



Message Header Analysis:



The first byte, 82, represents the compact protocol version.


compact_protocol_id       = 0x082


The second byte 21 indicates: How to calculate 21 for a message request?


COMPACT_VERSION           = 1
	COMPACT_VERSION_MASK      = 0x1f
	COMPACT_TYPE_MASK         = 0x0E0
	COMPACT_TYPE_BITS         = 0x07
	COMPACT_TYPE_SHIFT_AMOUNT = 5
	(COMPACT_VERSION & COMPACT_VERSION_MASK) | ((byte(typeId) << COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_MASK)


  Message request typeID is 1, brought into the calculation  


(0x01 & 0x1f) | ((0x01 << 5) & 0xe0

   = 0x01 | 0x20 & 0xe0

  = 0x01 | 0x20

  = 0x21


The third byte 01 is the serial number 01 after Varint.



The fourth byte 07 is the length of the message after Varint 07.



BYTE 6e 6c 6c for message name string Funcall



To start parsing parameters:



The first parameter of a function Funcall:



1:argstruct argstruct,



BYTE 1c represents a struct, a height of 4 is 1 for a number offset of 1, and a low of 4 for C indicates that the type 0x0c is a struct.



Offset from 1 save, used for the next field number offset calculation.


    Argstruct.argbyte =    argstruct.argstring = "str value"    argstruct.argi16 =    argstruct.argi32 =    argstruct.argi64 = 43
    Argstruct.argdouble = 11.22
    argStruct.ArgByte = 53
    argStruct.ArgString = "str value"
    argStruct.ArgI16 = 54
    argStruct.ArgI32 = 12
    argStruct.ArgI64 = 43
    argStruct.ArgDouble = 11.22


The first member of a struct;



Byte 13 35 represents the first member of the struct Argbyte,



A height of 4 is 1 for the number offset of 1, the lower 4 is 3 for the type 0x03 to the byte type, and the value 35 is the decimal assignment of 53.



A second member of the structure;



Bytes in each of the three 6c 75 65 represents the second member of the struct, argstring,



A height of 4 is 1 for a number offset of 1, and a low of 4 bits 8 for the type 0x08 is a binary string type,



09 represents the length of the string after Varint 9, the value of the 6c 75 65 for the string "str value"



Third member of the structural body;



Byte 6c represents the first member of the struct ArgI16,



The height 4 is 1 for the number offset 1, the lower 4 is 4 to indicate that the type 0x04 is a 16-bit numeric type, the value is 6c, the binary 110 1100, the right to move one bit, do zigzag decompression, get 11 0110, is the decimal value of 54.



Fourth member of the structural body;



Byte 15 18 represents the first member of the struct ArgI32,



A height of 4 is 1 for the number offset 1, the low 4 for 5 indicates that the type 0x05 is a 32-bit numeric type, a value of 18, a binary 1 1000, a right to move a bit, do zigzag decompression, get 1100, is the decimal value of 12.



Fifth member of the structural body;



Byte 16 56 represents the first member of the struct ArgI64,



The height 4 is 1 for the number offset 1, the lower 4 is 6 to indicate that the type 0x06 is a 64-bit numeric type, a value of 56, a binary 101 0110, a right to move a bit, do zigzag decompression, get 10 1011, is the decimal value of 43.



Sixth member of the structural body;



Byte 3d 0a D7 A3 70 26 40 represents the first member of the struct argdouble,



A height of 4 is 1 for the number offset of 1, the lower 4 is 7 for the type 0x07 is a double numeric type, the value is 3d 0a D7 A3 70 26 40, is 11.22.



End tag of struct



byte 00 Indicates the end of the struct body.



The second parameter of the function Funcall:



2:byte Argbyte,   



Byte 13 35 indicates Argbyte,



A height of 4 is 1 for the number offset of 1, the lower 4 is 3 for the type 0x03 to the byte type, and the value 35 is the decimal assignment of 53.



The third parameter of the function Funcall:
3:i16 argI16,



Byte 6c represents ArgI16,



The height 4 is 1 for the number offset 1, the lower 4 is 4 to indicate that the type 0x04 is a 16-bit numeric type, the value is 6c, the binary 110 1100, the right to move one bit, do zigzag decompression, get 11 0110, is the decimal value of 54.



The fourth parameter of the function Funcall:
4:i32 argI32,



Byte 15 18 indicates ArgI32,



A height of 4 is 1 for the number offset 1, the low 4 for 5 indicates that the type 0x05 is a 32-bit numeric type, a value of 18, a binary 1 1000, a right to move a bit, do zigzag decompression, get 1100, is the decimal value of 12.



The fifth parameter of the function Funcall:
5:i64 argI64,



Byte 16 44 indicates ArgI64,



The height 4 is 1 for the number offset 1, the lower 4 is 6 to indicate that the type 0x06 is a 64-bit numeric type, a value of 44, a binary 100 0100, a right to move a bit, do zigzag decompression, get 10 0010, is the decimal value of 34.



The sixth parameter of the function Funcall:
6:double argdouble,



Byte 3d 0a D7 A3 70 26 40 means argdouble,



A height of 4 is 1 for the number offset of 1, the lower 4 is 7 for the type 0x07 is a double numeric type, the value is 3d 0a D7 A3 70 26 40, is 11.22.



The seventh parameter of the function Funcall:
7:string argstring,



Bytes 6c 6f argstring 6e represents the



A height of 4 is 1 for a number offset of 1, and a low of 4 bits 8 for the type 0x08 is a binary string type,



05 indicates the length of the string after Varint is 5, the value is 6c 6f, and the string "login"



The eighth parameter of the function Funcall:
8:map<string, string> parammapstrstr,



BYTE 1b Geneva 6e, 6d, 6e, 6d 65 73 73 04 70 61 73 73 05 76 70 61 73 73 indicates Parammapstrstr,



A high 4-bit 1 represents a number offset of 1, and a low 4-bit B indicates that the type 0x0b is a map type.



02 indicates the number of map elements after Varint 2,



88 indicates that the type of the key and value for the map element is a binary string (high 4 bits 8 means the type of the key is 0x08 as a binary string type, and a low of 4 bits 8 indicates that the type of the value 0x08 is a binary string type)



Map's first key: 6e 6d 65 is a string of length 4 6e-min 6d 65 value "name"



The value of the first key of the map: 6e 6d 65 73 73 is a string of length 6 6e, 6d 65 73 73 Value "Namess"



The second key of map: 04 70 61 73 73 is a string with a length of 4 70 61 73 73 Value "pass"



The value of the second key of the map: 05 76 70 61 73 73 is the string with a length of 5 76 70 61 73 73 Value "Vpass"



The nineth parameter of the function Funcall:
9:map<i32, string> parammapi32str,



BYTE 1b in Geneva, 6c to 32 30 for PARAMMAPI32STR,



A high 4-bit 1 represents a number offset of 1, and a low 4-bit B indicates that the type 0x0b is a map type.



02 indicates the number of map elements after Varint 2,



58 indicates that the type of the key and value of the map element is a binary string (high 4 bits 5 means the type of the key 0x05 is a 32-bit numeric type, low 4 bits 8 indicates the value of type 0x08 is a binary string type)



Map of the first key: 14, Binary 1 0100, the right to move a bit, do zigzag decompression, get 1010, is the decimal value of 10.



The value of the first key of the map: 6c 31 30 is a string of length 5 6c 31 30 Value "VAL10"



Map of the second key: 28, Binary 101 000, the right to move a bit, do zigzag decompression, get 1 0100, is the decimal value of 20.



The value of the second key of map: 5 6c 32 30 is a string of length 5 76 70 61 73 73 Value "VAL20"



The tenth parameter of the function Funcall:
10:set<string> Paramsetstr,



BYTE 1a (6c) (6c) 65 33 for Paramsetstr,



A high 4-bit 1 represents a number offset of 1, and a low 4-bit a indicates that the type 0x0a is set type,



38 indicates the number and type of elements (high 4 bits 3 means set has 3 elements, low 4 bits 8 indicates that the type of the value is 0x08 as a binary string type)



First value of Set: 6c 65 31, Length 4 string 6c 65 31 for "Ele1"



Second value of Set: 6c 65 32, Length 4 string 6c 65 32 for "Ele2"



The third value of set: 6c 65 33, Length 4 string x 6c 65 33 for "Ele3"



The 11th parameter of the function Funcall:
11:set<i64> paramSetI64,



BYTE 1a, 2c 42 for paramSetI64,



A high 4-bit 1 represents a number offset of 1, and a low 4-bit a indicates that the type 0x0a is set type,



36 indicates the number and type of elements (high 4 bits 3 means set has 3 elements, low 4 bit 6 indicates value type 0X06 is 64 is numeric type)



Set of the first value: 16, Binary 10110, the right to move a bit, do zigzag decompression, get 1011, is the decimal value of 11.



Set of the second value: 2c, binary 101100, the right to move a bit, do zigzag decompression, get 10110, is the decimal value of 22.



Set of the third value: 42, binary 1000010, the right to move a bit, do zigzag decompression, get 100001, is the decimal value of 33.



The 12th parameter of the function Funcall:
12:list<string> Paramliststr,



Bytes 6c to 2e 6c 2e paramliststr,



A high 4-bit 1 represents a number offset of 1, and a low 4-bit 9 indicates that the type 0x09 is a list type.



28 indicates the number and type of elements (high 4 bits 3 means set has 2 elements, low 4 bits 8 indicates that the type of the value is 0x08 as a binary string type)



The first value of list: 6c 2e, the string length of 3 6c to 2e to "L1."



Second value of list: 6c 2e, 3-length string 6c + 2e for "L2."



The last byte 00 indicates the end of the message.



------------------------------------------------------------------------------------------------------------






Start analyzing the response data of the capture packet.


response:
0000   82 41 01 07 66 75 6e 43 61 6c 6c 09 00 28 14 72
0010   65 74 75 72 6e 20 31 20 62 79 20 46 75 6e 43 61
0020   6c 6c 2e 14 72 65 74 75 72 6e 20 32 20 62 79 20
0030   46 75 6e 43 61 6c 6c 2e 00





The first byte, 82, represents the compact protocol version.


compact_protocol_id       = 0x082


The second byte 41 indicates: How to calculate 41 for a message request?


COMPACT_VERSION           = 1
	COMPACT_VERSION_MASK      = 0x1f
	COMPACT_TYPE_MASK         = 0x0E0
	COMPACT_TYPE_BITS         = 0x07
	COMPACT_TYPE_SHIFT_AMOUNT = 5
	(COMPACT_VERSION & COMPACT_VERSION_MASK) | ((byte(typeId) << COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_MASK)


Message request typeID is 1, brought into the calculation


(0x01 & 0x1f) | ((0x02 << 5) & 0xe0
    = 0x01 | 0x40 & 0xe0
  = 0x01 | 0x40
  = 0x41


The third byte 01 is the serial number 01 after Varint.



The fourth byte 07 is the length of the message after Varint 07.



BYTE 6e 6c 6c for message name string Funcall






Response Parameters:



List<string>



Bytes-------------------------6e 6c 6c 2e



09 indicates that the type 0x09 is a list type,



00 indicates that the field is numbered 0 in response (the return value does not have a number ), because the return value does not have a field number, so the type and number are separated into different bytes.



28 indicates the number and type of elements (high 4 bits 3 means set has 2 elements, low 4 bits 8 indicates that the type of the value is 0x08 as a binary string type)



The first value of list: three-in-one, 6e, 6e, 6c, 6c 2e, String length 20, 20 31 20 62 79 20 46 6e 6c 6c 2e for "return 1 by Funcall."



The second value of the list: three-in-one, 6e, 62, 6e, 6c, 6c 2e, 20-length string, 20, 32, 20, 79, 20 46 6e 6c 6c 2e for "return 2 by Funcall."



The last byte 00 indicates the end of the response message.



Done.



Thrift Tcompactprotocol Compact Binary Protocol Analysis


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.