Section 23.3: Packets (Frame 1)                     [     ][home][next]

Bits are organized into packets, which are just abstract divisions of the bit stream in time. A packet is a kind of data structure, like a Pascal record or a C struct. It is broken into logical units, each of which has a predefined length and a set meaning. Fig. 23.3.1 shows a typical packet format.


Fig. 23.3.1: Typical packet format

This packet format has fixed and variable fields. The first 40 bits, called the header, are fixed in length and meaning. The next group of bits, representing the actual data, is variable in length, although it must always be units of 8 since we are transmitting bytes. This isn't always necessary and some protocols are bit-oriented rather than byte-oriented, being able to transmit arbitrary bit streams rather than forcing them to be broken into 8-bit bytes. In order to detect how long this section is, the fixed field immediately before it, which is a 16-bit byte count, must exist and tell how many bytes will follow. 216 is 65,536, so this many bytes can be sent in one packet. Though the data field is variable in length, there is nothing non-deterministic in this packet layout. By reading the first 40 bits the receiver knows exactly what the rest of the packet will look like as it arrives over the wire.