Skip to content

leafboo/http-from-tcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

Building an HTTP Server from TCP

In this readme, I will document my journey in building an http server from scratch.

Sections

OSI Model

The OSI Model

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.


Flow of data going through the OSI Model from top to bottom

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.


image


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)

image


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  |
    --------------------------------------------------------



image

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).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published