What is a segment (segment)?
A segment is a unit of data at the transport layer (L4). It is precisely in the form of segments that the transport layer transmits data between applications.
In short: a segment is a piece of application data packaged by the transport layer for transmission over the network.
Why a segment is needed
Applications often transmit large amounts of data. The transport layer does not send it all at once, instead it:
- splits the data into small parts
- packages each part as a segment
- sends the segments over the network
- reassembles the data on the receiver's side
What a segment consists of
A segment consists of two parts:
1. The transport layer header
It holds service information, for example:
- source port
- destination port
- service fields (numbers, flags, and so on)
The header is needed to:
- deliver data to the right application
- manage the transfer
2. The payload
This is:
- the application's data
- the reason the whole transfer happens
Segments and protocols
Important for the interview.
- TCP:
- uses segments
- a segment contains:
- sequence numbers
- acknowledgments
- service flags
- provides reliability
- UDP:
- also transmits data in segments (often called a "UDP datagram")
- without acknowledgments or ordering
Relationship to other layers
When data is transmitted:
- Transport layer → segment
- Network layer → packet
- Data link layer → frame
- Physical layer → bits
Each layer adds its own header.
What is important to remember
- a segment is L4
- a segment is encapsulated into an IP packet
- routers work with packets, not with segments
- a segment exists only between the end nodes
In short, for the interview
A segment is a unit of data at the transport layer, containing an L4 header and application data, used to transmit information between applications in an end-to-end connection.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.