TCP Segment Header

We'll now study TCP headers. They're far more complex than UDP headers and really are what allow for TCP to work properly!

Introduction

TCP headers play a crucial role in the implementation of the protocol. In fact, TCP segments without actual data and with headers are completely valid. They’re actually used quite often!

The size of the headers range from 20 - 60 bytes. Let’s discuss the header field by field.

Source and Destination Ports

Press + to interact
The source and destination ports are the first fields of the TCP header.
The source and destination ports are the first fields of the TCP header.

The source and destination port numbers are self-explanatory. They are exactly like the source and destination ports in UDP. Just for a refresher though, the source port is the port of the socket of the application that is sending the segment and the destination port is the port of the socket of the receiving application. The size of each field is two bytes.

Sequence Number

Press + to interact
The sequence number is the second field of the TCP header. It represents the first byte of data in the TCP segment.
The sequence number is the second field of the TCP header. It represents the first byte of data in the TCP segment.

Every byte of the TCP segment’s data is labeled with a number called a sequence number. The sequence number field in the header has the sequence number of the first byte of data in the segment.

Press + to interact
Each byte of a TCP segment is labeled with a sequence number.
Each byte of a TCP segment is labeled with a sequence number.

Note: The initial sequence number is a randomly generated number between 00 ...

Access this course and 1400+ top-rated courses and projects.