All these applications may use the network together. IP can take packets to the correct computer, but one more question remains:
Inside that computer, which application should receive the data?
This is where the Transport Layer becomes important.
The Transport Layer is Layer 4 of the OSI model. It provides logical communication between application processes running on different end systems.
Its major functions include process-to-process delivery, port addressing, segmentation, reassembly, multiplexing, demultiplexing, connection management, flow control and error control.
The two most important Transport Layer protocols in the TCP/IP suite are TCP and UDP.
What Is the Transport Layer?
The Transport Layer provides communication between application processes running on different hosts.
The Network Layer may deliver a packet to the correct computer, but that computer can run many applications at the same time.
The Transport Layer makes sure the data reaches the correct application process.
Position of Transport Layer in the OSI Model
Layer 4
Layer 3
The Transport Layer receives data from upper layers and uses Network Layer services to move that data between end systems.
Why Is the Transport Layer Needed?
Suppose a computer is running:
- A web browser
- An email application
- A video call
- A game
All of them may use the same IP address.
So IP address alone is not enough to identify the correct application.
The Transport Layer uses port numbers to identify application processes.
Port Number = Which application?
Process-to-Process Delivery
The Network Layer provides host-to-host delivery.
The Transport Layer goes one step further and provides process-to-process delivery.
Port 51000
Process-to-Process
Port 443
Layer 4: Process-to-Process
Functions of the Transport Layer
Port Addressing
A port number identifies an application process.
Transport protocols use source and destination port numbers.
Port Number Range
TCP and UDP port numbers are 16 bits long.
| Port Range | Name | General Use |
|---|---|---|
| 0–1023 | Well-Known Ports | Common standard services |
| 1024–49151 | Registered Ports | Registered applications and services |
| 49152–65535 | Dynamic / Private Ports | Often used temporarily by client applications |
Socket Address
A socket endpoint is commonly identified using an IP address and a port number.
192.0.2.20
443
Segmentation
Applications may generate large amounts of data.
The Transport Layer can divide this data into smaller units before sending it to the Network Layer.
Reassembly
At the destination, the Transport Layer combines received data so the receiving application obtains the original information.
Multiplexing
Many applications can send data through the Transport Layer at the same time.
The Transport Layer accepts data from multiple application processes and passes it toward the Network Layer.
Demultiplexing
At the receiver, Transport Layer information helps deliver incoming data to the correct application process.
Demultiplexing: Transport sends received data to the correct application.
Connection-Oriented Transport Service
A connection-oriented transport service establishes logical communication before normal data transfer begins.
TCP is the most important example.
Connection-Oriented
- Connection setup first
- Reliable delivery can be provided
- Sequence numbers
- Acknowledgements
- Retransmission
- Flow control
- Order preservation
Connectionless
- No connection setup
- Each datagram sent independently
- Lower protocol overhead
- No built-in TCP-style reliability
- No TCP-style ordered byte stream
Connectionless Transport Service
In a connectionless transport service, data can be sent without establishing a logical connection first.
UDP is the main example in the TCP/IP protocol suite.
UDP: Send without TCP connection setup
TCP vs UDP at the Transport Layer
- Connection-oriented
- Reliable byte stream
- Sequencing
- Acknowledgement
- Retransmission
- Flow control
- Congestion control
- Connectionless
- Datagram-oriented
- No connection setup
- No TCP-style retransmission
- No TCP-style ordering
- Small header
- Low protocol overhead
Transport Layer Design Issues
Designing a transport service is not only about moving data.
Several practical problems must be handled correctly.
1. Addressing as a Design Issue
The Transport Layer must identify the correct communicating application.
It does this using transport addresses such as port numbers.
2. Connection Establishment
When a connection-oriented protocol is used, both endpoints must agree that the connection exists before normal data transfer starts.
This prevents confusion caused by old duplicate packets and ensures both sides are ready.
3. Connection Release
A connection should not simply disappear while data is still being transferred.
A proper release mechanism allows endpoints to finish communication in an orderly way.
4. Flow Control
Flow control prevents a fast sender from sending data faster than the receiver can process or buffer it.
Sends quickly
Controls sending rate
Processes at safe rate
5. Buffering
Transport protocols may temporarily store data in memory buffers.
Buffers are useful when:
- Sender and receiver work at different speeds.
- Segments arrive while an application is temporarily busy.
- Reliable protocols need data for possible retransmission.
- Out-of-order data must wait for missing data.
6. Error Control
Reliable transport services need mechanisms to deal with data loss, duplication and ordering problems.
7. Crash Recovery
A host may crash while a connection is active.
After recovery, one side may no longer remember the old connection state.
Transport protocols therefore need mechanisms such as sequence numbers, timers and connection-state management to reduce confusion caused by old or duplicate communication.
What Is Connection Management?
Connection management includes the procedures used to:
- Establish a transport connection.
- Maintain communication state.
- Transfer data.
- Terminate the connection safely.
TCP is the best example of connection-oriented transport management.
TCP Three-Way Handshake
TCP establishes a connection using a three-step handshake.
Why Is Three-Way Handshake Needed?
The handshake confirms that communication works in both directions and that both endpoints are ready to begin the connection.
It also helps establish initial TCP sequence-number state.
After Connection Establishment
After the handshake is complete, TCP can begin normal data transfer.
During transfer, TCP can use:
- Sequence numbers
- Acknowledgements
- Retransmission
- Sliding-window flow control
- Congestion-control mechanisms
TCP Connection Termination
TCP supports communication in both directions.
Therefore each direction is closed independently.
A common orderly termination uses four control exchanges.
Important TCP Connection States
TCP uses states to remember the current condition of a connection.
The exact state path depends on which side opens or closes the connection.
Why TIME-WAIT Exists
TIME-WAIT helps prevent delayed old segments from being confused with a later connection using the same endpoint information.
It also allows retransmission of the final acknowledgement if necessary.
Flow Control vs Congestion Control
Students often mix these two concepts.
| Point | Flow Control | Congestion Control |
|---|---|---|
| Main Goal | Protect receiver | Protect network |
| Problem | Sender too fast for receiver | Too much traffic inside network |
| Main Focus | Sender–receiver rate difference | Network capacity and congestion |
| TCP Example | Receive window | Congestion window and congestion algorithms |
Congestion Control → Network problem
Services Provided to Applications
Depending on the protocol, the Transport Layer can provide:
- Connection-oriented communication
- Connectionless communication
- Reliable delivery
- Ordered delivery
- Port-based process identification
- Segmentation and reassembly
- Flow control
- Error recovery
Quick TCP and UDP Header Difference
| Feature | TCP | UDP |
|---|---|---|
| Minimum Header | 20 bytes | 8 bytes |
| Connection | Connection-oriented | Connectionless |
| Reliability | Provides reliable transport mechanisms | No built-in TCP-style reliability |
| Sequence Number | Present | Not present |
| Acknowledgement | Supported | No TCP-style ACK mechanism |
| Flow Control | Yes | No TCP-style flow control |
Simple Transport Layer Numericals
Numerical 1: Maximum Number of Port Values
Port number field size:
Numerical 2: Number of Segments
Suppose:
Numerical 3: TCP Header Overhead
Suppose:
Numerical 4: UDP Header Overhead
Suppose:
Numerical 5: Sequence Range Example
If a simplified protocol uses a 4-bit sequence field:
Possible values:
Transport Layer Remember Tricks
Port = Process
Congestion protects network.
Common Transport Layer Exam Mistakes
Not complete. Network Layer provides host-level delivery, while Transport Layer provides process-to-process communication.
Wrong. A port number identifies the application process.
Wrong. TCP is connection-oriented; UDP is connectionless.
Wrong. UDP does not provide TCP-style retransmission and reliability.
Wrong. Segmentation is a Transport Layer concept. IP fragmentation is a Network Layer concept.
Wrong. TCP normally starts using SYN → SYN-ACK → ACK.
Wrong. Flow control protects the receiver; congestion control handles network overload.
Wrong. Normal full-duplex TCP termination commonly involves FIN and ACK exchanges in both directions.
Wrong. Well-known ports are 0–1023.
Wrong. TCP and UDP port fields are 16 bits.
Wrong. TCP minimum header is 20 bytes. UDP header is 8 bytes.
Wrong. Demultiplexing is mainly associated with directing received transport data to the correct application process.
40 Important Transport Layer Questions With Answers
20 Transport Layer MCQs With Answers
A. 2
B. 3
C. 4
D. 7
A. Process-to-process delivery
B. Only electrical transmission
C. Only MAC addressing
D. Only routing
A. Port number
B. MAC vendor name
C. TTL
D. Subnet mask
A. 8 bits
B. 16 bits
C. 32 bits
D. 64 bits
A. 255
B. 1024
C. 65535
D. 65536
A. Connection-oriented
B. Connectionless only
C. Physical Layer protocol
D. Routing protocol
A. Connectionless
B. Connection-oriented only
C. Network Layer protocol
D. Data Link protocol
A. Two-way handshake only
B. Three-way handshake
C. Five-way handshake
D. No handshake
A. FIN
B. ACK
C. SYN
D. RST
A. SYN + ACK
B. FIN
C. ACK only
D. UDP
A. Breaking application data into smaller transport units
B. Breaking one IP packet due to MTU
C. Converting IPv4 to IPv6
D. Resolving IP to MAC
A. Receiver
B. Domain name
C. Router table only
D. Physical cable
A. Network overload
B. Receiver application name
C. MAC address format
D. HTML files
A. 8 bytes
B. 16 bytes
C. 20 bytes
D. 40 bytes
A. 8 bytes
B. 20 bytes
C. 32 bytes
D. 40 bytes
A. TCP
B. UDP
C. IP only
D. ARP
A. Multiple applications to share transport/network service
B. One router to change IP version automatically
C. One packet to remove all headers
D. Only one application to use a network
A. Connection termination
B. Address resolution
C. Routing update
D. Fragmentation
A. ESTABLISHED
B. HEXTET
C. BROADCASTING
D. ROUTED
A. IP address + port number
B. MAC address + subnet only
C. TTL + checksum
D. IP version + frame size
Frequently Asked Questions
What is the Transport Layer in simple words?
The Transport Layer provides communication between application processes running on different end systems.
Which OSI layer is the Transport Layer?
The Transport Layer is Layer 4 of the OSI model.
What are the main functions of the Transport Layer?
Its main functions include process-to-process delivery, port addressing, segmentation, reassembly, multiplexing, demultiplexing, connection management, flow control and error control.
What is a port number?
A port number is a 16-bit identifier used by transport protocols to identify application processes or service endpoints.
What is segmentation?
Segmentation divides large application data into smaller transport units before they are sent to the Network Layer.
What is multiplexing?
Multiplexing allows data from multiple applications to share Transport Layer and lower-layer communication services.
What is connection management?
Connection management includes establishing, maintaining and terminating logical transport connections.
What is the TCP three-way handshake?
TCP establishes a connection using SYN, SYN-ACK and ACK messages.
What is the difference between flow control and congestion control?
Flow control prevents a sender from overwhelming the receiver, while congestion control reduces traffic when the network itself becomes overloaded.
What is the difference between TCP and UDP?
TCP is connection-oriented and provides reliable ordered transport, while UDP is connectionless and uses a smaller, simpler transport mechanism without TCP-style reliability.
What is a socket?
A socket endpoint is commonly identified using an IP address and a port number.
What is the normal TCP connection close sequence?
A common orderly TCP close uses FIN, ACK, FIN and ACK exchanges because the two communication directions can close separately.
