← all topics
7 · App architectures, sockets, transport services
Slides 2-1 → 2-14 · Sample midterm 1a, 1c
Where apps run
- Network apps are programs that run on end systems (hosts) and talk to each other over the network. Example: browser ↔ web server.
- Network-core devices (routers) do not run user applications. That's why new apps can be written and spread quickly: you only change the end systems.
Two architectures
| Client-server | Peer-to-peer (P2P) |
| Server? | Always-on server with a permanent IP address, often in data centers | No always-on server |
| Who talks to whom | Clients talk to the server. Clients don't talk directly to each other | Arbitrary end systems (peers) talk directly |
| Connectivity | Clients may be intermittently connected, with dynamic IPs | Peers are intermittently connected and change IPs → complex management |
| Scaling | Server must handle every client (add data centers) | Self-scalability: new peers bring new service capacity as well as new demand |
| Examples | HTTP, IMAP, FTP | P2P file sharing (BitTorrent) |
Processes and sockets
- Process = a program running on a host. On the same host, processes use inter-process communication (from the OS). On different hosts, they exchange messages.
- Client process = the one that initiates communication. Server process = the one that waits to be contacted.
- Even in P2P, every connection has a client side and a server side. A peer is both: it's a client when downloading and a server when uploading.
- Socket = the door between the app process and the transport layer. The process shoves a message out the door and relies on the transport infrastructure to deliver it to the socket on the other side. Two sockets are involved, one on each end.
- Above the socket is controlled by the app developer. Below it (transport, network, link, physical) is controlled by the OS.
Addressing a process (sample 1a)
A process is identified by IP address + port number.
- The IP address (32 bits) identifies the host. That alone isn't enough: many processes run on the same host.
- The port number identifies the process on that host.
- Well-known ports: HTTP server = 80, mail (SMTP) server = 25.
- Example: to reach the gaia.cs.umass.edu web server, use IP 128.119.245.12, port 80.
What an application-layer protocol defines
- Types of messages (e.g. request, response)
- Syntax: what fields are in a message and how they're separated
- Semantics: what the information in the fields means
- 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?
| Need | Meaning | Example |
| Data integrity | 100% reliable delivery, or can tolerate loss? | File transfer and web need no loss. Audio can tolerate some |
| Throughput | Needs a minimum rate, or uses whatever it gets ("elastic")? | Multimedia needs a minimum. Email and file transfer are elastic |
| Timing | Needs low delay? | Internet telephony, interactive games (10's of ms) |
| Security | Encryption, data integrity | |
Common apps
| App | Data loss | Throughput | Time-sensitive? | Transport |
| File transfer | no loss | elastic | no | TCP |
| Email | no loss | elastic | no | TCP (SMTP) |
| Web | no loss | elastic | no | TCP (HTTP) |
| Real-time audio/video | loss-tolerant | audio 5 kbps–1 Mbps, video 10 kbps–5 Mbps | yes, 10's of ms | TCP or UDP |
| Streaming audio/video | loss-tolerant | same | yes, a few seconds | TCP (HTTP, DASH) |
| Interactive games | loss-tolerant | kbps+ | yes, 10's of ms | UDP or TCP |
| Text messaging | no loss | elastic | yes and no | |
TCP vs UDP
| TCP | UDP |
| ✓ 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)
- No connection setup → no extra RTT delay before sending.
- No congestion control → the app can send as fast as it wants (good for real-time, loss-tolerant apps).
- No connection state → a server can support more clients.
- Small header (8 bytes vs TCP's 20).
- Apps that need reliability can add it themselves on top (e.g. HTTP/3). DNS also runs over UDP.
Securing TCP: TLS
- Plain TCP and UDP sockets have no encryption. Passwords sent into a socket cross the Internet in cleartext.
- TLS (Transport Layer Security) gives encrypted TCP connections, data integrity, and end-point authentication.
- TLS is implemented in the application layer: apps use TLS libraries, which use TCP underneath.
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 →