Application and transport layers
How an application actually hands a message to the network through a socket, and how the transport layer moves that message end to end using either TCP or UDP.
- Name the application-layer protocols the unit lists and what each one is for.
- Explain what a socket is and where it sits between the application and transport layers.
- State what the transport layer does at the sender and at the receiver.
- Compare TCP and UDP across connection setup, reliability and delivery guarantees.
15 min read
Intuition
Knowing the four layers exist does not explain how a running program actually gets a message onto the network. An application does not touch packets or bytes on the wire directly. It writes to an interface, the socket, and everything below that point, breaking the message up, addressing it, and moving it, is somebody else’s job. This page covers that interface and the two protocols that do the moving underneath it.
Mechanism
The application layer is where network applications, the Web, email, voice over IP, and their protocols live. The unit’s own examples: HTTP requests and transfers Web documents, SMTP transfers e-mail messages, FTP transfers files between two end systems, and DNS lets hosts and DNS servers communicate to resolve names. The packet of information exchanged at this layer is called a message.
Mechanism
A message does not leave a process on its own. A process, a program running within a host, sends and receives through a socket. The unit’s own analogy: a socket is a door. The sending process shoves its message out the door, and relies on the transport infrastructure on the other side to deliver it to the receiving process’s own door, its socket. Two sockets are always involved, one on each side.
This is also where the layer boundary sits. The socket, and everything above it, is controlled by the application developer, that is the application layer. Everything below the socket is controlled by the operating system, the transport layer and below. Sockets are the API between the application and transport layers.
Mechanism
The transport layer provides logical communication between application processes running on different hosts. At the sender, it breaks application messages into segments and passes them to the network layer. At the receiver, it reassembles those segments back into messages and passes them up to the application layer. Two transport protocols are available on the Internet: TCP and UDP.
Compare
Connection-oriented and reliable. Uses a three-way handshake before any data flows. Point-to-point: one sender, one receiver. Delivers a reliable, in-order byte stream, with cumulative ACKs and retransmission. Full duplex. Provides flow control (the sender will not overwhelm the receiver) and congestion control (the sender adjusts to network conditions), pipelining with dynamic window sizing, and enforces a Maximum Segment Size (MSS).
Connectionless and lightweight. No handshake, so no round-trip-time overhead. “No frills” best-effort delivery: segments may be lost or arrive out of order, with no flow control and no congestion control. Faster to start, simpler, includes a checksum for basic error detection, and still works when network service is degraded. Any extra reliability has to be added by the application itself.
Mechanism
TCP’s connection setup is the three-way handshake: the client sends a SYN packet asking whether the server will accept a new connection; the server replies with a SYN/ACK; the client replies with an ACK. Only after this exchange do client and server begin sending segments that carry actual data.
Exam detail
Use cases are worth memorising in the unit’s own pairing: TCP for file transfer, email, Web pages, and any application that needs guaranteed delivery. UDP for loss-tolerant, rate-sensitive streaming media, DNS, SNMP, HTTP/3, and other real-time applications. The reason in both directions is the same trade-off: TCP spends time and overhead, the handshake, ACKs, retransmission, to guarantee delivery; UDP skips all of that to move faster, and pushes any reliability the application still needs back onto the application itself.
Aside
The unit’s own diagrams of application communication, the socket interface, transport-layer logical communication, and the TCP three-way handshake as a message-exchange diagram, are all figures that did not survive extraction from the source material. The definitions and the handshake steps above are stated directly in the text and are unaffected.
Recall
An application chooses UDP over TCP for a real-time video call, even though UDP can lose or reorder segments. Why is that the right trade-off here?
A dropped or late video frame is tolerable, a delayed one is not, since by the time TCP retransmits a lost segment and waits for it to arrive in order, the moment for that frame has already passed. UDP’s lack of a handshake and lack of retransmission keeps latency low, which matters more for real-time media than perfect, in-order delivery does.
Recall
- Applications talk to the network through a socket. Everything above the socket is the application layer, controlled by the developer; everything below it is handled by the operating system.
- The application layer’s unit of data is a message; the transport layer’s is a segment.
- TCP is connection-oriented, reliable, and uses a three-way handshake, cumulative ACKs, flow control and congestion control.
- UDP is connectionless and best-effort, with no handshake, no flow control and no congestion control.
- TCP suits guaranteed-delivery use cases; UDP suits loss-tolerant, rate-sensitive or latency-sensitive ones.
Source
Week 8 slides PDF