Reads a frame from an input stream and returns an interface that can be cast into one of the following:


2.3.5 frame Details

All frames consist of a header (7 octets), a payload of arbitrary size, and a 'frame-end' octet that detects malformed frames:

0      1         3             7                  size+7 size+8
+------+---------+-------------+  +------------+  +-----------+
| type | channel |     size    |  |  payload   |  | frame-end |
+------+---------+-------------+  +------------+  +-----------+
 octet   short         long         size octets       octet

To read a frame, we:

  1. Read the header and check the frame type and channel.
	2. Depending on the frame type, we read the payload and process it.
  3. Read the frame end octet.

In realistic implementations where performance is a concern, we would use “read-ahead buffering” or

“gathering reads” to avoid doing three separate system calls to read a frame.

ReadFrame is referenced in 0 repositories