Book HomeTCP/IP Network AdministrationSearch this book

G.2. TCP Segment Header

This description is taken from pages 15 to 17 of RFC 793, Transmission Control Protocol.

TCP Header Format 
                                     
    0                   1                   2                   3    
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1  
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |          Source Port          |       Destination Port        | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |                        Sequence Number                        | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |                    Acknowledgment Number                      | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |  Data |           |U|A|P|R|S|F|                               | 
   | Offset| Reserved  |R|C|S|S|Y|I|            Window             | 
   |       |           |G|K|H|T|N|N|                               | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |           Checksum            |         Urgent Pointer        | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |                    Options                    |    Padding    | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |                             data                              | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
 
  Source Port:  16 bits 
 
    The source port number. 
 
  Destination Port:  16 bits 
 
    The destination port number. 
 
  Sequence Number:  32 bits 
 
    The sequence number of the first data octet (byte) in this segment 
    (except when SYN is present). If SYN is present the sequence 
    number is the initial sequence number (ISN) and the first data 
    octet is ISN+1. 
 
  Acknowledgment Number:  32 bits 
 
    If the ACK control bit is set, this field contains the value of 
    the next sequence number the sender of the segment is expecting to 
    receive.  Once a connection is established this is always sent. 
 
  Data Offset:  4 bits 
 
    The number of 32 bit words in the TCP Header.  This indicates 
    where the data begins.  The TCP header (even one including options) 
    is an integral number of 32 bits long. 
 
  Reserved:  6 bits 
 
    Reserved for future use.  Must be zero. 
 
  Control Bits:  6  single-bit values (from left to right): 
 
    URG:  Urgent Pointer field significant 
    ACK:  Acknowledgment field significant 
    PSH:  Push Function 
    RST:  Reset the connection 
    SYN:  Synchronize sequence numbers 
    FIN:  No more data from sender 
 
  Window:  16 bits 
 
    The number of data octets (bytes) the sender of this segment is 
    willing to accept. 
 
  Checksum:  16 bits 
 
    The checksum field is the 16 bit one's complement of the one's 
    complement sum of all 16 bit words in the header and text. 
 
  Urgent Pointer:  16 bits 
 
    This field contains the current value of the urgent pointer as a 
    positive offset from the sequence number in this segment.  The 
    urgent pointer points to the sequence number of the octet 
    following the urgent data.  This field is only be interpreted 
    in segments with the URG control bit set. 
 
  Options:  variable 
 
    Options may occupy space at the end of the TCP header and are a     multiple of 8 bits in length.


Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.