Transmission Control Protocol (TCP) Segment Header, Transmission Control Protocol, TCP Header Fields

In Transmission Control Protocol (TCP) Segment Header lesson, you will learn more about TCP Segment Header, different fields in TCP Header and the use of these fields.

Transmission Control Protocol - TCP - Header

Transmission Control Protocol (TCP) Segment Header.

Source port : 16 Bit number which identifies the Source Port number (Sending Computer's TCP 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.

ACK : Acknowledgement.

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.

Related Tutorials
Introduction to TCP/IP, Features of TCP/IP, TCP/IP History, What is RFC (Request for Comments)
What is PDU (Protocol Data Unit)
How data is moved through different layers of OSI model at sending and receiving computers
Names of data packets at different layers of OSI model
Why OSI model failed
Four Layers of original TCP/IP model, Functions of four layers of TCP/IP model
Five layered TCP/IP model
Comparison between four layered TCP/IP model and five layered TCP/IP model
Protocols/Standards at various layers of TCP/IP model
Comparison between TCP/IP and OSI models
How data is moved through different layers of TCP/IP model at sending and receiving computers
TCP/IP Encapsulation and Decapsulation
Physical Layer (Layer 1)
Datalink Layer (Layer 2)
Ethernet Frame Format
What is MAC address or Layer 2 address or physical address
Network Layer (Layer 3)
IPv4 Protocol, IPv4 header and fields of IPv4 header
IPv4 addresses, IPv4 Address Classes, IPv4 Address Classifications
Transport Layer (Layer 4)
Transmission Control Protocol (TCP) Segment Header
TCP Three-way Handshake
What port numbers, socket numbers, well-known ports and dynamically assigned ports
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
Application Layer (Layer 5)