It's nine at night. You're on a video call with your mother in Sylhet, a 300 MB update is downloading in the background, and in a browser tab the job circular you've been waiting for has just opened. All three share the same Wi-Fi, the same router, the same IP address. Yet the video never lands in the browser, the update arrives without a single byte missing, and the video call quietly throws away a late frame now and then. Who sorts the traffic between three programs? Who promises the update that nothing will be lost, and why doesn't the video call want that promise?
The answer is one layer of the network, the transport layer, with its two protocols, TCP and UDP. Bank IT, BCS and BPSC papers ask about it constantly, in MCQs and in written questions with diagrams and sums.
By the end you'll know how data finds the right program, read UDP and TCP headers from raw bytes, explain how TCP builds a reliable stream on an unreliable network, and draw the handshake and the close with every sequence number. You'll count segments and overhead, run real socket code, work out what a window allows, trace TCP's congestion window round by round, and choose TCP or UDP for a job, with the ports exams love.
We'll go in nine parts, easy to hard, from ports and sockets to choosing between TCP and UDP.
Why it matters: The MCQs test single facts: which protocol is connection-oriented, which service uses UDP, which port is SSH's or DNS's, what an IP address plus a port is called, at which layer congestion control happens. The written papers ask you to compare TCP and UDP, draw the 3-way handshake, explain flow and congestion control, list TCP's functions, and work out throughput from sizes, windows and delays. Every one of these is taught below, with its reason.
Question (Sonali Bank and BDBL — Senior Officer (IT) — Exam: 25.09.2021 (AUST)): Which of the following services uses both TCP and UDP ports?
a) DNS
b) TFTP
c) SSH
d) TELNET