← 🚚 Transport Layer: UDP & TCP
Subtopic 1 of 4

7.1UDP and ports

The idea

UDP is a thin layer over IP: ports plus an optional checksum, no connection and no reliability. TCP adds a connection, ordering, retransmission and flow and congestion control. A port selects the application; a socket is IP address plus port.

Think of it like this: UDP is dropping a postcard in the post box. TCP is a phone call: you dial, talk, and hang up.

Why it exists

GATE asks which protocol or port an application uses and what UDP does not provide.

How it works

  1. UDP header: 8 bytes (ports, length, checksum).
  2. TCP header: 20 to 60 bytes with sequence, ack, flags and window.
  3. A TCP connection is identified by (source IP, source port, destination IP, destination port).
  4. Well-known ports: HTTP 80, HTTPS 443, DNS 53, SMTP 25, POP3 110, IMAP 143, FTP 21 and 20.

Worked example: Which transport do real-time multimedia, file transfer, DNS and email use?

UDP, TCP, UDP and TCP respectively (GATE 2013).

Now play with it

  • →Read the port table and pick a UDP service.
  • →Compare the header sizes in the first table.
UDPTCP
Connectionnonehandshake
Reliabilitynoneacks, retransmission, ordering
Header8 bytes20 to 60 bytes
Flow / congestion controlnoneyes
Unitdatagram (message boundaries kept)byte stream
Typical useDNS, DHCP, RIP, video, VoIPHTTP, SMTP, FTP, SSH
PortServiceTransport
20, 21FTP data and controlTCP
22SSHTCP
25SMTPTCP
53DNSUDP (TCP for zone transfer)
67, 68DHCPUDP
80HTTPTCP
110POP3TCP
143IMAPTCP
179BGPTCP
443HTTPSTCP
520RIPUDP

Check yourself

Which protocol uses UDP for ordinary queries?

Remember: UDP: no connection, no reliability, 8-byte header. TCP: reliable stream. 16-bit ports.
Exam notes (the dense version)

UDP is connectionless and unreliable: an 8-byte header (source port, destination port, length, checksum) and no ordering, retransmission or flow control. Good for DNS, streaming, DHCP, RIP, SNMP, where speed or multicast matters. A socket is (IP address, port); a TCP connection is identified by the 4-tuple (source IP, source port, destination IP, destination port). Ports are 16 bits: well-known 0 to 1023 (HTTP 80, HTTPS 443, DNS 53, SMTP 25, FTP 21 and 20, POP3 110, IMAP 143).

Previous year questions: Transport Layer: UDP & TCP (11)

PYQs are grouped by topic, so this is the full set for Transport Layer: UDP & TCP; try the ones that match this subtopic. Open all 11 on the topic page.