TCP Segment Format

One of the most interesting aspects of TCP is that data get transferred as Segments from the TCP layer. Yeah! I know you will then ask me you told data to get transferred as packets right? How come you say segment now.DThe difference between segment and packet?

Segment = Transport Layer = Transport Header + Data

Packet = IP Header + Transport Layer = IP Header + (Transport Header + Data)

At each layer the data is getting encapsulated!

What is Segments do? What are the different roles Segment has?

The segment can be called as the “Jack of all Trades” messages – they are flexible and serve a variety of purposes. A single field format is used for all segments, with a number of header fields that implement the many functions and features for which TCP is responsible. One of the most notable characteristics of TCP segments is that they are designed to carry both control information and data simultaneously. This reduces the number of segments sent since they can perform more than one function.

What are the functionalities offered by headers? 

In basic these are the functionalities:

  1. Process Addressing
  2. Sliding Window  (Catch me up in the next post to learn about Sliding Window)
  3. Control Bits and Fields
  4. Miscellaneous

Look the Below table for better Understanding.


Filed Bytes Purpose
Source Port 2 Specifies the 16-bit source port number
Destination Port 2 Specifies the 16-bit destination port number
Sequence Number 4 Helps in ordering the packets
Acknowledgement Number 4 Helps in establishing the connection
Data Offset 1/2 Specifies the number of 32-bit words of data in the TCP header.
Reserved 3/4 6bits reserved for future
Control Bits 3/4 Explained Below *
Window 2 Indicate the number of octets of data the sender is willing to accept while receiving the ack no.
CheckSum 2 For Integrity
Urgent Pointer 2 Used in conjunction with URG control bit for priority data transfer
Options Variable Generic method to add one or more optional sets of data/
Padding Variable
Data Variable The data to be transferred.


Control Bits * : These are the bits set to inform the communication in TCP.


Field Bit Purpose
URG 1 When set 1 indicates Priority data transfer.
ACK 1 When set to 1 to the sender is carrying Ack no
PSH 1 Enables the Push feature.
RST 1 The sender has encountered a problem and reset the connection.
SYN 1 The synchronization bit is used to request Sequence numbers and establish a connection.
FIN 1 The Finish Bit is used for closing the connection

Well, this is it with TCP Segment and if you have any queries post here and I would reply.

To see the changes in the code with Segment check my Github!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s