Typorithm · medium

UDP & Ports

udp-portsnetworksudpportsconnectionless
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn UDP & Ports

0%

L4 — Transport Layer

UDP is connectionless — no handshake, acknowledgements, or ordering — so it is lightweight and low-latency. It underpins DNS, DHCP, QUIC/HTTP3, and real-time media. Ports (0–65535) identify the service on a host, with well-known ports below 1024. ss -uan lists UDP sockets.

UDP trades reliability for speed. There is no handshake, no acknowledgements, and no ordering guarantee — a datagram is sent and may arrive, arrive out of order, or be lost. That minimalism makes it lightweight and very low-latency.

Because it is so cheap, UDP underpins services where a tiny round trip matters: DNS lookups, DHCP, QUIC and HTTP/3, and real-time audio and video. Applications that need reliability build it on top of UDP themselves, as QUIC does.

Ports identify which service on a host a packet is for. The 16-bit port space runs 0–65535, with well-known ports below 1024 (such as 53 for DNS) reserved for standard services. ss -uan lists the UDP sockets currently bound on the machine.

01

UDP is connectionless: no handshake, no ACK, no ordering.

02

It powers DNS, DHCP, QUIC/HTTP3, and real-time media.

03

Ports run 0–65535; well-known ports are below 1024.

ss -uan
nc -u -v 8.8.8.8 53
# UDP: connectionless, no ACK, no ordering
dig @8.8.8.8 example.com
iperf3 -u -c host

Read the implementation

Connect each part of the code to the concept before you type.

1. List UDP sockets

ss -uan lists UDP sockets (-u) with numeric addresses (-n) in all states (-a).

ss -uan

2. Send a datagram

nc -u sends UDP datagrams; here to port 53, the DNS port, with no handshake first.

nc -u -v 8.8.8.8 53

3. UDP traits

UDP sends datagrams with no connection, no acknowledgements, and no guaranteed ordering.

# UDP: connectionless, no ACK, no ordering

4. A DNS query

dig queries a DNS server (port 53), the classic UDP-based service.

dig @8.8.8.8 example.com

5. UDP throughput

iperf3 -u runs a UDP throughput test, useful for measuring loss and jitter on a path.

iperf3 -u -c host

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

UDP & Ports: Lesson & Practice · Typorithm | ApplyDjinn