Fundamentals 15 min read

How Does a Simple Chat Message Travel Across the Internet? Inside the OSI Model

Using a familiar chat example, this article walks through the OSI seven‑layer model, illustrating each layer’s role—from the application’s HTTP request to the physical bitstream—through analogies with parcel delivery, complete with data format transformations and visual diagrams.

大转转FE
大转转FE
大转转FE
How Does a Simple Chat Message Travel Across the Internet? Inside the OSI Model

Open Systems Interconnection Model (OSI)

The OSI model is a conceptual framework introduced by the International Organization for Standardization (ISO) to standardize how diverse computer systems interconnect worldwide.

Ever wondered how a simple "Are you there?" message in WeChat travels across the world? It’s like a parcel that gets packaged, labeled, and routed—OSI’s seven‑layer model is the standard operating manual for that network parcel.

Just as a logistics system moves a package from sender to receiver, network communication moves data from the application layer down to the physical layer.

1. Application Layer

When you send a message, you first open the app and fill in the required information, similar to creating a shipping label. In networking, this corresponds to generating an HTTP request with a request line, headers, and body. The application layer provides the interface and protocols (e.g., HTTP) that applications use.

Data form: The user’s text "Are you there?" is encapsulated in an HTTP request.

Application layer data transmission

Application layer data transmission
Application layer data transmission

2. Presentation Layer

This layer handles data transformation, encryption, compression, and protocol conversion—much like adding protective padding or compressing a parcel before shipping.

Data form: Encrypted/encoded message, e.g., Encrypted(UTF-8("Are you there?")) → "x7f3e9a2b...".

Presentation layer data transmission

Presentation layer data transmission
Presentation layer data transmission

3. Session Layer

The session layer manages dialog control, state, and synchronization, similar to tracking an order’s status in a logistics system.

Data form: SessionHeader(SessionID:123456) + Encrypted(UTF-8("Are you there?"))

Session layer data transmission

Session layer data transmission
Session layer data transmission

4. Transport Layer

This layer ensures reliable (TCP) or best‑effort (UDP) delivery, handling segmentation, sequencing, and retransmission—akin to a smart sorting center that guarantees each parcel reaches the correct process.

Data form: TCPHeader(SrcPort:53987, DstPort:443, Seq:12345) + SessionHeader + Encrypted(...)

Transport layer data transmission

Transport layer data transmission
Transport layer data transmission

5. Network Layer

The network layer determines the optimal path for packets, similar to a driver using navigation to choose the shortest route. It adds IP addressing and may fragment packets.

Data form: IPHeader(SrcIP:192.168.1.100, DstIP:123.456.789.101) + TCPHeader + SessionHeader + Encrypted(...)

Network layer data transmission

Network layer data transmission
Network layer data transmission

6. Data Link Layer

Operating within a local network, this layer packages IP packets into frames with MAC addresses, performs error detection (CRC), and handles flow control—much like local parcel sorting and verification.

Data form: FrameHeader(SrcMAC:00:1A:2B:3C:4D:5E, DstMAC:00:1F:2B:3C:4D:5E) + IPHeader + TCPHeader + SessionHeader + Encrypted(...) + FrameTrailer(CRC)

Data link layer data transmission

Data link layer data transmission
Data link layer data transmission

7. Physical Layer

The physical layer transmits raw bit streams over media such as copper cables, fiber optics, or wireless signals—analogous to the roads and vehicles that move parcels.

Data form: Bitstream (e.g., 0101010001101001...).

Physical layer data transmission

Physical layer data transmission
Physical layer data transmission

Full Process Summary

Application Layer: User types "Are you there?" → HTTP request generated.

Presentation Layer: Data encrypted/compressed → "x7f3e9a2b...".

Session Layer: Session ID added → "SID:123456+x7f3e9a2b...".

Transport Layer: TCP header added.

Network Layer: IP header added.

Data Link Layer: Frame header/trailer added.

Physical Layer: Converted to bitstream.

Reverse Process (Receiving)

Physical Layer: Bitstream → data frames.

Data Link Layer: Verify MAC/CRC, strip frame.

Network Layer: Verify IP, strip IP header.

Transport Layer: Reassemble TCP segment, strip TCP header.

Session Layer: Validate session ID, strip session header.

Presentation Layer: Decrypt/compress → original text.

Application Layer: Render message in WeChat.

Model Details

The table below summarizes each OSI layer’s main function, typical devices, and common protocols. (Presented as text for brevity.)

Physical Layer: Transmit/receive bit streams; devices: repeaters, cables, hubs; protocols: RJ45, IEEE 802.3.

Data Link Layer: Frame creation, MAC addressing, error detection; devices: NICs, bridges, switches; protocols: Ethernet (802.3), Token Ring (802.5).

Network Layer: Routing packets; devices: routers, firewalls; protocols: IP, ICMP, ARP, RIP.

Transport Layer: Reliable/unreliable delivery; protocols: TCP, UDP.

Session Layer: Manage sessions; protocols: NFS, SQL, NetBIOS, RPC.

Presentation Layer: Data representation, encryption, compression; protocols: various compression/encryption standards.

Application Layer: User interfaces; protocols: FTP, DNS, Telnet, SNMP, SMTP, HTTP, WWW, NFS.

Data Flow Diagram

OSI data flow diagram
OSI data flow diagram

Conclusion

The OSI layered concept continues to influence network protocol design, troubleshooting, and education. Its principle of high cohesion and low coupling serves as a golden rule for designing complex systems, helping developers improve maintainability, scalability, and cross‑team collaboration.

References:

OSI model layer functions and protocols: https://download.csdn.net/blog/column/12586693/141336860

5‑minute guide to OSI: https://baijiahao.baidu.com/s?id=1826978610692714900

Protocol Stacknetwork fundamentalscomputer networkingOSI Modelnetwork layers
大转转FE
Written by

大转转FE

Regularly sharing the team's thoughts and insights on frontend development

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.