The OSI Model: Transport to Application
The bottom three layers get a packet to the right machine. But the files box runs several services, Asha's browser has a dozen tabs open, and the data might be a compressed image, an encrypted page or plain text. The top four OSI layers sort out which program, which conversation, which format and which request.
The rule
Transport picks the program, Session the conversation, Presentation the format, Application the request.
Layer 4 — Transport. End-to-end delivery between programs, identified by port numbers. TCP adds handshakes, ordering and resending; UDP just sends. Units are segments (TCP) or datagrams (UDP). Firewalls that filter by port are working at layer 4.
Layer 5 — Session. Opening, keeping and closing a dialogue between two applications, and picking it up again after an interruption — for example, a large upload that resumes from a checkpoint instead of starting over, or a login session kept alive while you work.
Layer 6 — Presentation. How the bytes are represented: character encoding (such as UTF-8), data formats (JPEG, PNG), compression, and encryption and decryption. It lets two systems agree on what the bits mean.
Layer 7 — Application. The network protocols applications use to ask for things: HTTP, DNS, SMTP, IMAP, SSH, FTP. Careful: layer 7 is the protocol a browser speaks, not the browser program itself.
In the real internet, layers 5 to 7 are rarely separate pieces of software; one application or library usually handles all three. TLS, for instance, manages a secure session and encrypts data, so it is often described as spanning layers 5 and 6. The OSI split is still useful for thinking and talking, even where the code blurs it.