Mobile Networking · How Apps Talk · Lesson 3 of 4
Ports & Protocols
Learn how ports pick the right app and how TCP and UDP differ.
Ports: Which Program Gets the Packet
An IP address gets a packet to the right device. A port number gets it to the right program on that device. Think of the IP address as a building's street address and the port as the apartment number.
Ports are numbered from 0 to 65535. Numbers 0 to 1023 are the well-known ports, reserved for common services. A few you'll see a lot:
443for HTTPS, the encrypted web80for plain HTTP53for DNS
When your phone opens a connection, it picks a temporary source port for its own side, usually a high number. In the packet lab, the phone used 51544 and the server listened on 443. The server replies to that temporary port, so your phone knows which app the reply belongs to.
Ports also tell an observer what kind of traffic they're looking at. Traffic to port 443 is usually encrypted web traffic. Security teams scan their own networks for open ports to find services that shouldn't be running.
TCP and UDP
Packets ride on a transport protocol. The two big ones are TCP and UDP.
TCP sets up a connection before sending data. It numbers the data, checks that everything arrives, resends anything lost, and puts it all back in order. Web pages, chat messages and app downloads have traditionally used TCP because every byte has to be right.
UDP just sends packets, with no setup and no delivery guarantee. That makes it lighter and faster. Voice calls, video calls and games often use UDP, because a late packet is useless anyway and a tiny glitch beats a pause. Most DNS lookups use UDP too, since a short question and answer each fit in one packet.
The line has blurred lately. A newer protocol called QUIC runs on top of UDP and adds its own reliability and built-in encryption. HTTP/3, the newest version of the web's main protocol, runs on QUIC. Major browsers and many big apps support it, so you'll also see UDP traffic going to port 443.
Can you answer these?
- What is the highest possible port number?
- HTTP/3 runs on QUIC. Which transport protocol does QUIC run on top of?
Answer them in the app to earn 70 XP.
Answer in the app