background image
TCP/IP and the DoD Model
119
F I G U R E 3 . 3
TCP segment format
The TCP header is 20 bytes long. You need to understand what each field
in the TCP segment is. The TCP segment contains the following fields:
Source port The port number of the host sending the data. (Port num-
bers will be explained a little later in this section.)
Destination port The port number of the application requested on the
destination host.
Sequence number Puts the data back in the correct order or retransmits
missing or damaged data, a process called sequencing.
Acknowledgment number Defines which TCP octet is expected next.
HLEN Stands for header length, which defines the number of 32-bit
words in the header.
Reserved Always set to zero.
Code bits Control functions used to set up and terminate a session.
Window The window size the sender is willing to accept, in octets.
Checksum The cyclic redundancy check (CRC), because TCP doesn't
trust the lower layers and checks everything. The CRC checks the header
and data fields.
Bit 0
Bit 15
Source port (16)
Destination port (16)
Window (16)
Urgent (16)
Code bits (6)
Reserved (6)
Checksum (16)
Header
length (4)
Sequence number (32)
Acknowledgment number (32)
Options (0 or 32 if any)
Data (varies)
Bit 16
Bit 31
20 bytes
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com