The Application Layer of Internet
When you open a browser, send an email, or stream a video, you’re using network applications.
What Is a Network Application?
A network application is any software program that runs on end systems (laptops, phones, or servers) and communicates over the Internet.
Examples -
- Web browsers and servers (using HTTP)
- Email clients (using SMTP, POP3, IMAP)
- Messaging apps (like WhatsApp)
- File-sharing services (like BitTorrent)
Each application is designed to communicate using a specific set of rules known as application-layer protocols.
How Network Applications Work
Here are the main building blocks and design choices behind every network application.
Application Architecture
- Client-Server Model - One machine (the server) provides services, and other machines (the clients) request those services. Example - A web browser (client) sends a request to a web server, which responds with the web page.
- Peer-to-Peer (P2P) Model - All participating devices (called peers) both request and provide services to each other. Example - BitTorrent, you download and upload pieces of files from/to other peers.
Processes Communicating
A process is a program running on a device. When network applications communicate, it’s really the processes that are talking and not the computers themselves. Each process is identified by -
- IP address (which host it’s on)
- Port number (which application on that host)
Example: Your web browser might talk to a web server at IP 192.0.2.1 on port 80 (HTTP).
The Role of Sockets
A socket is like a door through which data flows in and out of a process. It serves as the interface between the application and the transport layer (TCP or UDP).
Socket is the interface between application and transport layer. All data sent or received by an application travels through the socket.
Transport Services Needed by Applications
| Service | What It Means | Who Needs It |
|---|---|---|
| Reliable Data Transfer | Ensures no data is lost or duplicated | Email, file transfer |
| Throughput | Needs guaranteed data rate | Video streaming |
| Timing | Low delay between messages | Online gaming, voice calls |
| Security | Data should be encrypted/authenticated | Banking apps, messaging apps |
What Is an Application-Layer Protocol ?
An application-layer protocol defines message types and Message format (what fields are in the message) and the rules for sending/receiving messages (when to respond, what happens on error, etc.)
Examples of Application Protocols -
| Protocol | Used For | Transport Layer Used |
|---|---|---|
| HTTP | Web browsing | TCP |
| SMTP | Sending email | TCP |
| POP3/IMAP | Retrieving email | TCP |
| DNS | Translating names to IPs | UDP (mostly) |
| BitTorrent | File sharing (P2P) | TCP |
Designing Your Own Protocol ?
If you’re building a custom network app, and want to create your own protocol then you define -
- The type of messages (e.g., HELLO, DATA, BYE)
- The format of the messages (e.g., JSON, XML, plain text)
- The rules for how messages are exchanged
- Whether you want TCP or UDP as your transport protocol
Example - a multiplayer game might send position updates using UDP every 50ms, while a messaging app might use TCP to ensure messages aren’t lost.