In this readme, I will document my journey in building an http server from scratch.
| Layer | Protocol Data Unit (PDU) |
|
|---|---|---|
| 7 | Application | Data |
| 6 | Presentation | Data |
| 5 | Session | Data |
| 4 | Transport | Segments |
| 3 | Network | Packets |
| 2 | Data Link | Frames |
| 1 | Physical | Bits |
Top to Bottom - Encapsulation.
Bottom to Top - Decapsulation.
PDU - This is the form of the data while traversing each layer of the OSI model.
Session -> Transport
The transport layer uses various protocols like the TCP and UDP. In this project, I'll be using TCP. TCP breaks up the session data into segments and attaches a TCP header to each segments. Part of the TCP Header is the source of the application's port address and the intended destination of the application's port address.
Trasport -> Network
The IP is used as the protocol in this layer. IP takes the segment and attaches the IP header to it, forming something that's called an IP packet. The IP header contains the source IP (where it came from) and the destination IP (where it will go)
Network -> Data Link
The src and the destination MAC address is then attached to the packet, which forms the PDU of this layer.
Note:
--------------------------------------------------------
| | src MAC address | dest MAC address |
|-----------------|-----------------|------------------|
| encapsulation | sender's PC | router |
|-----------------|-----------------|------------------|
| decapsulation | router | receiver's PC |
--------------------------------------------------------
Data Link -> Physical
The frames are then turned into bits, then the bits are then turned into signals. The transmission of these signals depends on the medium being used (wired/wireless).
