"Life is all about sharing. If we are good at something, pass it on." - Mary Berry

How a gRPC message uses length-prefixed framing?

visitor badge

2020-05-06

Categories: DevOps Networking

Once we have the encoded data to send to the other end, we need to package the data in a way that other end can easily extract the information. gRPC uses a message framing technique called length-prefixed framing.

Filter gRPC messages:

1$ tshark -r grpc.pcapng -Y 'grpc'

Find out a stream: DATA:

1216 923.033355    127.0.0.1 → 127.0.0.1    GRPC 108 DATA[1] (GRPC) (PROTOBUF)

and show the packet details:

1tshark -r grpc.pcapng -Y "frame.number == 216" -V
1HyperText Transfer Protocol 2
2    GRPC Message: /book.BookInfo/getBook, Request
3        Compressed Flag: Not Compressed (0)
4        Message Length: 38
5        Message Data: 38 bytes

Tags: grpc protocol-buffers length-prefixed-framing

Edit on GitHub

Related Posts: