In Transmission Control Protocol (TCP) Segment Header lesson, you will learn more about Transmission Control Protocol (TCP) Segment Header, different fields in Header and the use of these fields.
Transmission Control Protocol (TCP) Segment Header.
Source port: 16 Bit number which identifies the Source Port number (Sending Port).
Destination port: 16 Bit number which identifies the Destination Port number (Receiving Port).
Sequence number: 32 Bit number used for byte level numbering of TCP segments. If you are using TCP, each byte of data is assigned a sequence number. If SYN flag is set (during the initial three way handshake connection initiation), then this is the initial sequence number. The sequence number of the actual first data byte will then be this sequence number plus 1. For example, let the first byte of data by a device in a particular TCP header will have its sequence number in this field 50000. If this packet has 500 bytes of data in it, then the next packet sent by this device will have the sequence number of 50000 + 500 + 1 = 50501.
Acknowledgment Number: 32 Bit number field which indicates the next sequence number that the sending device is expecting from the other device.
Header Length: 4 Bit field which shows the number of 32 Bit words in the header. Also known as the Data Offset field. The minimum size header is 5 words (binary pattern is 0101).
Reserved: Always set to 0 (Size 6 bits).
Control Bit Flags: We have seen before that TCP is a Connection Oriented Protocol. The meaning of Connection Oriented Protocol is that, before any data can be transmitted, a reliable connection must be obtained and acknowledged. Control Bits govern the entire process of connection establishment, data transmissions and connection termination. The control bits are listed as follows: They are:
URG: Urgent Pointer.
PSH: This flag means Push function. Using this flag, TCP allows a sending application to specify that the data must be pushed immediately. When an application requests the TCP to push data, the TCP should send the data that has accumulated without waiting to fill the segment.
RST: Reset the connection. The RST bit is used to RESET the TCP connection due to unrecoverable errors. When an RST is received in a TCP segment, the receiver must respond by immediately terminating the connection. A RESET causes both sides immediately to release the connection and all its resources. As a result, transfer of data ceases in both directions, which can result in loss of data that is in transit. A TCP RST indicates an abnormal terminination of the connection.
SYN: This flag means synchronize sequence numbers. Source is beginning a new counting sequence. In other words, the TCP segment contains the sequence number of the first sent byte (ISN).
FIN: No more data from the sender. Receiving a TCP segment with the FIN flag does not mean that transferring data in the opposite direction is not possible. Because TCP is a fully duplex connection, the FIN flag will cause the closing of connection only in one direction. To close a TCP connection gracefully, applications use the FIN flag.
Window: indicates the size of the receive window, which specifies the number of bytes beyond the sequence number in the acknowledgment field that the receiver is currently willing to receive.
Checksum: The 16-bit checksum field is used for error-checking of the header and data.
Urgent Pointer: Shows the end of the urgent data so that interrupted data streams can continue. When the URG bit is set, the data is given priority over other data streams (Size 16 bits).
In this lesson, you have learned different fields in Transmission Control Protocol (TCP) Segment Header and the use of these fields. The fields in Transmission Control Protocol (TCP) Segment Header are Source Port, Destination Port, Sequence Number, Acknowledgement Number, Header Length, Flags, Window Size, TCP Checksum and Urgent Pointer. Click "Next" to continue.
• TCP/IP Transport Layer
• Transmission Control Protocol (TCP)
• TCP Three-way Handshake
• Multiplexing and Demultiplexing using port numbers
• Transmission Control Block (TCB)
• TCP Sliding Window
• TCP Connection Termination
• User Datagram Protocol (UDP)
• Differences between TCP and UDP