The network layer can reach the correct host, but that does not explain how data reaches the correct process on that host. It also does not tell you what TCP and UDP actually promise. Transport service differs from transport protocol. A single connection therefore combines ports, sequence numbers, acknowledgements and loss recovery.
What the Transport Layer Actually Does
IP provides host-to-host delivery; transport provides process-to-process delivery. Port numbers act as service access points. Segmentation divides application data, reassembly reconstructs it, and multiplexing or demultiplexing carries several application streams through the layer. A protocol may also provide connection management, ordering, error recovery, flow control and congestion control.
Service and protocol are not synonyms. Service is what an application can request. TCP and UDP implement different service models, so transport does not automatically mean reliability or connection establishment.
The mental model is simple: an application writes to a socket, the transport protocol adds its header and tracks state as required, IP carries the packet, and the receiving transport entity delivers the payload to the correct application.
Ports, Sockets, Multiplexing and Demultiplexing
Browser A at 10.1.1.8:53000 and browser B at 10.1.1.9:53000 can both connect to server 203.0.113.20:443. The repeated client port is valid because it occurs on different hosts. TCP separates them using source IP, source port, destination IP and destination port.
A port is a transport identifier, not a process or machine. A socket endpoint combines an IP address, transport protocol and port. A TCP connection joins two endpoints and uses the complete connection key, not destination port 443 alone.
The browsers multiplex application streams into transport. The server uses header port fields to demultiplex data to the correct socket while retaining each connection's identity.

TCP and UDP Service Models Compared
Property | TCP | UDP |
|---|---|---|
Setup | Connection establishment before data transfer | No connection setup |
Data model | Byte stream | Datagram messages |
Ordering | Delivers bytes in order | Does not reorder datagrams |
Loss recovery | Retransmits missing data | Does not itself retransmit |
Duplicate handling | Suppresses duplicate bytes | Does not itself remove duplicate datagrams |
Flow control | Protects the receiver | Not provided by UDP |
Congestion control | Regulates sending for network conditions | Not provided by UDP |
Message boundaries | Not preserved | Preserved |
Typical fit | Complete, ordered transfer | Timely or simple message exchange |
A file transfer needs every byte in order, which suits TCP. Live voice may favour timely datagrams and handle loss itself. DNS-style request-response traffic benefits from low setup overhead, but the application must handle timeouts and retries.
UDP includes a checksum field. Therefore, saying that UDP has no error detection is a trap. Its lack of built-in retransmission and ordering is a different issue.
Worked TCP Trace: Setup, 2,800 Bytes, One Lost Segment and Recovery
Client 10.1.1.8:53000 opens TCP to 203.0.113.20:443 with client ISN 4000, server ISN 7000, MSS 1,000 bytes and advertised window 2,000 bytes.
The handshake is:
Client sends
SYN seq=4000.Server sends
SYN+ACK seq=7000, ack=4001.Client sends
ACK seq=4001, ack=7001.
SYN consumes one sequence number, so the first client data byte is 4001. The 2,800 bytes are divided as follows:
Segment | Sequence and length | Byte range |
|---|---|---|
S1 |
|
|
S2 |
|
|
S3 |
|
|
The 2,000-byte window permits S1 and S2. S1 arrives and produces cumulative ACK=5001, which opens room for S3, but S2 is lost. Assume the receiver buffers out-of-order S3. It sends duplicate ACK=5001 because byte 5001 is still expected.
Only one duplicate ACK appears, so fast retransmit is not triggered. The timer expires and S2 is retransmitted. It fills the gap before buffered S3, making bytes through 6800 contiguous and producing cumulative ACK=6801.
The client then sends FIN seq=6801; the server replies ACK=6802. With no server application data, the server later sends FIN seq=7001; the client replies ACK=7002. Each FIN consumes one sequence number. A half-close can close one direction while leaving the other available.

Reliability, Flow Control and Congestion Control Are Different Jobs
Sequence numbers identify byte positions, cumulative ACKs identify the next expected byte, a checksum detects corruption, and retransmission repairs loss. An ACK confirms receipt by peer TCP, not processing by the receiving application.
Flow control protects the receiver through rwnd; congestion control protects the network through cwnd. Under simplified assumptions, the outstanding-data limit is the smaller value:
If
rwnd = 2,000 bytesandcwnd = 3,000 bytes, thenmin(2,000, 3,000) = 2,000 bytesmay be outstanding.If
rwndlater becomes5,000 byteswhilecwndremains3,000 bytes, thenmin(5,000, 3,000) = 3,000 bytesmay be outstanding.
Delayed ACKs change acknowledgement timing, while window scaling expands the range represented by rwnd. Neither turns rwnd and cwnd into the same quantity.
Common Transport Layer Traps
"A port identifies a machine." Wrong because IP identifies the host; the port helps identify the application endpoint.
"TCP preserves messages." Wrong because TCP exposes a byte stream, not application write boundaries.
"One segment means one sequence number." Wrong because TCP sequence numbers count bytes.
"ACK 6801 means byte 6801 arrived." Wrong because
6801is the next expected byte."Receiver window equals congestion window." Wrong because
rwndprotects the receiver andcwndprotects the network."Reliability equals flow control." Wrong because reliability repairs loss or corruption; flow control prevents receiver overload.
"UDP cannot be reliable." Wrong because an application can build reliability over UDP.
"Connection-oriented means a physical path." Wrong because TCP keeps logical state without reserving a physical route.
S3 causes ACK=5001 because S2 is missing. Retransmitted S2 closes the gap before buffered S3, so the ACK jumps to 6801. One duplicate ACK is insufficient for fast retransmit.
How GATE and Interviews Test These Services
Typical questions cover sequence and ACK arithmetic, ports, flow versus congestion control, protocol choice, message boundaries and guarantees.
Three quick checks from the trace are enough to test the arithmetic:
After in-order S1, the next ACK is
5001.When only out-of-order S3 arrives after the gap, the ACK remains
5001.After retransmitted S2 fills the gap, the final cumulative ACK is
6801.
In an interview, explain why each result follows instead of merely naming TCP. For the application layer immediately above TCP and UDP, practise with Application Layer MCQs. For the IP layer below, use Subnetting MCQs.
Short Version and the Next Study Step
Transport extends host-to-host IP delivery into process-to-process delivery.
Ports identify transport endpoints, while sockets combine protocol, IP address and port.
TCP provides a reliable ordered byte stream; UDP preserves datagrams without adding retransmission or ordering.
TCP sequence and acknowledgement values count bytes, and an ACK names the next expected byte.
rwndprotects the receiver, whilecwndprotects the network.
KnowledgeGate currently has 120+ live practice questions on Transport Layer Services. GATE aspirants can continue with GATE Guidance by Sanchit Sir and the broader GATE category. Placement learners can follow Computer Science Fundamentals for Placements.
Redraw the worked timeline from memory and explain every ACK before attempting the practice questions.




