page-211

1
Sec. 11.11 TCP Segment Format 211 Like most protocols, a message is divided into two conceptual parts: a header that contains meta-data and a payload area that carries data. Figure 11.7 shows the TCP segment format. 0 4 8 16 24 31 SOURCE PORT DESTINATION PORT SEQUENCE NUMBER ACKNOWLEDGEMENT NUMBER HLEN RESER. CODE BITS WINDOW CHECKSUM URGENT POINTER OPTIONS (IF ANY) PADDING PAYLOAD ... Figure 11.7 TCP segment format with a TCP header followed by a payload. The header, known as the TCP header, consists of at least 20 octets and may con- tain more if the segment carries options. The header has the expected identification and control information. Fields SOURCE PORT and DESTINATION PORT contain the TCP port numbers that identify the application programs at the ends of the connection. The SEQUENCE NUMBER field identifies the position in the sender’s octet stream of the data in the segment. The ACKNOWLEDGEMENT NUMBER field identifies the number of the octet that the source expects to receive next. Note that the sequence number refers to the stream flowing in the same direction as the segment, while the ac- knowledgement number refers to the stream flowing in the opposite direction from the segment. The HLEN² field contains an integer that specifies the length of the segment header measured in 32-bit multiples. It is needed because the OPTIONS field varies in length, depending on which options are included. Thus, the size of the TCP header varies depending on the options selected. The 4-bit field marked RESER is reserved for future use (a later section describes a proposed use). Some segments carry only an acknowledgement, while some carry data. Others carry requests to establish or close a connection. TCP software uses the 8-bit field la- beled CODE BITS to determine the purpose and contents of the segment. The eight bits tell how to interpret other fields in the header according to the table in Figure 11.8. TCP software advertises how much data it is willing to accept every time it sends a segment by specifying its buffer size in the WINDOW field. The field contains a 16-bit unsigned integer in network-standard byte order. Window advertisements provide an example of piggybacking because they accompany all segments, including those carry- ing data as well as those carrying only an acknowledgement. ²The TCP specification says the HLEN field is the offset of the data area within the segment.

description

page-211

Transcript of page-211

  • Sec. 11.11 TCP Segment Format 211

    Like most protocols, a message is divided into two conceptual parts: a header thatcontains meta-data and a payload area that carries data. Figure 11.7 shows the TCPsegment format.

    0 4 8 16 24 31SOURCE PORT DESTINATION PORT

    SEQUENCE NUMBERACKNOWLEDGEMENT NUMBER

    HLEN RESER. CODE BITS WINDOWCHECKSUM URGENT POINTER

    OPTIONS (IF ANY) PADDINGPAYLOAD

    . . .

    Figure 11.7 TCP segment format with a TCP header followed by a payload.

    The header, known as the TCP header, consists of at least 20 octets and may con-tain more if the segment carries options. The header has the expected identification andcontrol information. Fields SOURCE PORT and DESTINATION PORT contain theTCP port numbers that identify the application programs at the ends of the connection.The SEQUENCE NUMBER field identifies the position in the senders octet stream ofthe data in the segment. The ACKNOWLEDGEMENT NUMBER field identifies thenumber of the octet that the source expects to receive next. Note that the sequencenumber refers to the stream flowing in the same direction as the segment, while the ac-knowledgement number refers to the stream flowing in the opposite direction from thesegment.

    The HLEN field contains an integer that specifies the length of the segmentheader measured in 32-bit multiples. It is needed because the OPTIONS field varies inlength, depending on which options are included. Thus, the size of the TCP headervaries depending on the options selected. The 4-bit field marked RESER is reserved forfuture use (a later section describes a proposed use).

    Some segments carry only an acknowledgement, while some carry data. Otherscarry requests to establish or close a connection. TCP software uses the 8-bit field la-beled CODE BITS to determine the purpose and contents of the segment. The eight bitstell how to interpret other fields in the header according to the table in Figure 11.8.

    TCP software advertises how much data it is willing to accept every time it sends asegment by specifying its buffer size in the WINDOW field. The field contains a 16-bitunsigned integer in network-standard byte order. Window advertisements provide anexample of piggybacking because they accompany all segments, including those carry-ing data as well as those carrying only an acknowledgement.33333333333333333333333333333333

    The TCP specification says the HLEN field is the offset of the data area within the segment.