← all topics

7 · App architectures, sockets, transport services

Slides 2-1 → 2-14 · Sample midterm 1a, 1c

Where apps run

Two architectures

Client-serverPeer-to-peer (P2P)
Server?Always-on server with a permanent IP address, often in data centersNo always-on server
Who talks to whomClients talk to the server. Clients don't talk directly to each otherArbitrary end systems (peers) talk directly
ConnectivityClients may be intermittently connected, with dynamic IPsPeers are intermittently connected and change IPs → complex management
ScalingServer must handle every client (add data centers)Self-scalability: new peers bring new service capacity as well as new demand
ExamplesHTTP, IMAP, FTPP2P file sharing (BitTorrent)

Processes and sockets

Addressing a process (sample 1a)

A process is identified by IP address + port number.

What an application-layer protocol defines

  1. Types of messages (e.g. request, response)
  2. Syntax: what fields are in a message and how they're separated
  3. Semantics: what the information in the fields means
  4. Rules for when and how processes send and respond to messages

Open protocols are defined in RFCs, so anyone can implement them and they interoperate (HTTP, SMTP). Proprietary protocols are not public (Skype, Zoom).

What transport service does an app need?

NeedMeaningExample
Data integrity100% reliable delivery, or can tolerate loss?File transfer and web need no loss. Audio can tolerate some
ThroughputNeeds a minimum rate, or uses whatever it gets ("elastic")?Multimedia needs a minimum. Email and file transfer are elastic
TimingNeeds low delay?Internet telephony, interactive games (10's of ms)
SecurityEncryption, data integrity

Common apps

AppData lossThroughputTime-sensitive?Transport
File transferno losselasticnoTCP
Emailno losselasticnoTCP (SMTP)
Webno losselasticnoTCP (HTTP)
Real-time audio/videoloss-tolerantaudio 5 kbps–1 Mbps, video 10 kbps–5 Mbpsyes, 10's of msTCP or UDP
Streaming audio/videoloss-tolerantsameyes, a few secondsTCP (HTTP, DASH)
Interactive gamesloss-tolerantkbps+yes, 10's of msUDP or TCP
Text messagingno losselasticyes and no

TCP vs UDP

TCPUDP
✓ Reliable transport between processes✗ Unreliable ("best effort")
✓ Flow control: sender won't overwhelm the receiver✗ No flow control
✓ Congestion control: throttles the sender when the network is overloaded✗ No congestion control
✓ Connection-oriented: setup needed between client and server✗ No connection setup
Neither provides: timing, minimum throughput guarantee, or security.

Why do we need UDP? (sample 1c)

Securing TCP: TLS

Quick check

1. In the client/server model, how do you uniquely identify a client process? (sample 1a) By its IP address + port number. The IP address identifies the host, and the port identifies which process on that host, because many processes can run on one host.
2. Give 3 differences between client-server and P2P. Client-server has an always-on server with a permanent IP, and clients don't talk to each other. P2P has no always-on server, and peers talk directly. P2P is self-scalable (new peers add capacity), but harder to manage because peers come and go and change IPs.
3. In a P2P file-sharing session, which peer is the client and which is the server? The peer downloading (initiating) is the client, and the peer uploading (waiting to be contacted) is the server. Every peer can be both.
4. What is a socket? The door between an application process and the transport layer. The app sends and receives messages through it. The app developer controls everything above it, and the OS controls everything below it.
5. TCP can provide reliable service, but UDP can't. Why do we need UDP? (sample 1c) No connection setup delay, no congestion control (the app controls its own rate), no connection state, and a smaller header. That suits loss-tolerant, delay-sensitive apps like real-time audio/video, games, and DNS.
6. Name 2 things that neither TCP nor UDP provides. Any two of: timing guarantees, minimum throughput guarantees, security (encryption).
7. Which apps are "elastic"? Apps that use whatever throughput they get: file transfer, email, web.

← 6 · Protocol layers · all topics · 8 · HTTP →