全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Length-prefixed framing?

Definition 16.9 University Computer Science — Year 2 · 第 16 章 — Sockets

In length-prefixed framing, a message of nn bytes is sent as 4 bytes holding nn in network byte order, followed by the nn bytes. Decoding a buffer reads 4 bytes as a length nn, then takes the next nn bytes as the message, and starts again after it.

The request who 1 framed, byte by byte (offsets above): the length 5 in four big-endian bytes, then the five bytes of the message. The receiver reads the four bytes, then exactly five more; whatever follows is the next message.
The request who 1 framed, byte by byte (offsets above): the length 5 in four big-endian bytes, then the five bytes of the message. The receiver reads the four bytes, then exactly five more; whatever follows is the next message.
在原文中阅读 →