Computer Networking › Section B · The application layer › Topic B.1
Principles of network applications
Every reason people use the internet, from video calls to online banking, is a network application. Before studying the web, email or DNS, it helps to see the choices every application designer faces: how to arrange the programs, how they find each other, and what they need from the network beneath them.
Applications live at the edge
A network application is a set of programs running on end systems, such as phones, laptops and servers, that exchange messages over the network. A browser and a web server, or a streaming app and a video server, are typical pairs. Developers write software only for end systems. Routers and switches work at the network layer and below, as the topic "Protocol layers and encapsulation" explains, so they never run application code. Keeping applications at the edge is why new ones can launch without anyone changing the core.
Two architectures: client-server and peer-to-peer
In the client-server architecture, an always-on host called the server answers requests from many clients, and clients never talk to each other directly. Because the server stays on at a known, stable address, clients can always reach it. One machine cannot serve millions of users, so large services run in data centres holding thousands of servers, at real cost in power and bandwidth. In a peer-to-peer (P2P) architecture, user-owned hosts called peers exchange data directly, with little or no reliance on dedicated servers. P2P is self-scaling, because each new peer adds upload capacity as well as demand, but its decentralised design makes security, performance and reliability harder to manage.
Processes, clients and servers
Strictly, it is processes, running programs, that communicate across the network, not hosts. In every communication session, the process that starts the contact is called the client, and the process that waits to be contacted is the server. A browser is the client and the web server the server. In P2P file sharing a single peer plays both roles: it is the client when it asks another peer for data, and the server when another peer asks it.
Sockets: the door to the network
A process sends and receives messages through a socket, the software interface between the application layer and the transport layer inside a host. Picture the process as a house and the socket as its front door: the process pushes a message out and trusts the transport service to carry it to the destination's door. Because programs are written against it, the socket is the network's application programming interface (API). The developer controls the application side, but on the transport side can only pick the protocol and set a few parameters, such as buffer sizes.
Addressing a process
To reach a process on another host, a sender needs two things: the host's IP address and a port number naming the receiving socket on that host, as the Computer Science topic "Internet protocols: layers, TCP, and UDP" introduced. Port numbers are 16-bit values. Standard services use well-known ports: 80 for HTTP, 443 for HTTPS, 25 for SMTP mail transfer, 53 for DNS and 22 for SSH. The Internet Assigned Numbers Authority (IANA) keeps the official list. A client needs no fixed port: its operating system gives each new socket a temporary, or ephemeral, port, and the server replies to that port.
What an application can ask of transport
Transport services can be compared along four dimensions. Reliable data transfer means every byte arrives intact and in order; email, file transfer and banking need it, while loss-tolerant applications such as voice calls accept a small glitch. Throughput matters for bandwidth-sensitive applications, which need a minimum rate: a voice codec running at 32 kbit/s is of little use at half that rate. Elastic applications, such as downloads and web pages, use whatever throughput is available. Timing matters for interactive applications, such as calls and games, where delays of a few hundred milliseconds are noticeable. Security can include confidentiality, integrity and end-point authentication.
What the internet actually offers
Internet applications choose between two classic transport protocols. TCP is connection-oriented, with a handshake before data flows, and gives a reliable, ordered byte stream, plus congestion control that throttles senders when the network is overloaded. UDP is connectionless and minimal: no handshake, no delivery guarantee, no ordering and no congestion control. Neither encrypts data. Applications add Transport Layer Security (TLS), currently version 1.3, on top of TCP through libraries. QUIC, standardised in 2021, builds reliable, encrypted streams on top of UDP and now carries HTTP/3, as the topic "Evolution of the transport layer: QUIC" explains. None of these guarantees throughput or delay.
Worked example: matching applications to services
Choose a transport for four applications. 1. A file-sync app: losing a byte corrupts a document, it is elastic and has no tight deadline, so it needs reliability and uses TCP with TLS. 2. A bank's website: also loss-intolerant and private, so HTTPS, which is HTTP over TLS over TCP, or HTTP/3 over QUIC. 3. A voice-call app: loss-tolerant, bandwidth-sensitive and time-sensitive, so it prefers UDP, where a lost packet is skipped rather than retransmitted late. 4. Because some firewalls block UDP, many call apps fall back to TCP when UDP fails. Check: no option guarantees the call's throughput or delay, so the app must adapt its own bit rate.
Worked example: elastic and bandwidth-sensitive traffic together
A home link carries 20 Mbit/s downstream. One person watches a video that needs a steady 5 Mbit/s while another downloads a 300 MB file, where 1 MB is \(10^6\) bytes. 1. Convert the file to bits: \(300 \times 8 = 2{,}400\) Mbit. 2. If the video keeps its 5 Mbit/s, the elastic download gets the remaining 15 Mbit/s. 3. Time: \(2{,}400 \div 15 = 160\) s. 4. With the video stopped, the download takes \(2{,}400 \div 20 = 120\) s. Check: the elastic transfer stretches, but the video cannot. Below 5 Mbit/s it would stall unless the player switched to a lower bit rate. Real transfers run a little slower because of header overheads.
Application-layer protocols
Each application-layer protocol fixes four things: the message types, such as requests and responses; the syntax, which fields appear and how they are separated; the semantics, what each field means; and the rules for when a process sends or answers a message. Open protocols such as HTTP and SMTP are published by the Internet Engineering Task Force as RFCs, so any browser that follows the HTTP rules works with any server that does. Others are proprietary and unpublished. A protocol is only one part of an application: the web also needs HTML, browsers and server software.
Common mistakes to avoid
First, thinking routers run application code; applications run only on end systems. Second, calling a host the client or server permanently: the roles belong to processes in one session, and a P2P peer plays both. Third, treating a port number as identifying a host; the IP address picks the host and the port picks the socket. Fourth, believing TCP or UDP encrypts data; TLS or QUIC provides encryption. Fifth, assuming the internet guarantees throughput or delay; applications must cope without such guarantees. Sixth, mixing up an application, such as the web, with its protocol, HTTP.
Key takeaways
Applications run only on end systems, in a client-server or P2P architecture; the initiating process is the client. Processes use sockets, the API to transport, and are addressed by IP address plus port, such as 443 for HTTPS. Needs for reliability, throughput, timing and security differ; elastic applications adapt to any rate. TCP is reliable and connection-oriented, UDP is minimal, TLS adds security, and QUIC brings encrypted streams over UDP. No internet transport guarantees rate or delay. Application-layer protocols define message types, syntax, semantics and rules.
Flashcards
Flashcard
Programs on end systems that exchange messages over a network
Test your understanding
Question 1 of 5
In a peer-to-peer file-sharing session, peer A asks peer B to send it a chunk of a file. Which statement is correct?
Question 2 of 5
A server host runs both a web server and an SSH server. What tells the host which of these processes should receive an arriving message?
Question 3 of 5
Which of these is an elastic application?
Question 4 of 5
A 20 Mbit/s link carries a 4 Mbit/s video stream. At the same time, a 150 MB file downloads using the rest of the link. About how long does the download take?
Question 5 of 5
Which service does neither TCP nor UDP provide to applications?
