2-Dec-2021
Internet Primer
How users interacting with the computer through internet?
Something in between users and internet when users connecting to internet
1. IP (internet protocol) Address
for machine to identify itself location on the Internet
the scheme for unique 32-bit naming addresses for computers are IP address
it is usually represented by 4 clusters of 8-bit decimals numbers

Only 4 billion addresses could be provided
— private IP address ←allow the address for computers to share the same address
Renew it to IPv6 (128-bit) to phase out 32-bit



DHCP
— Dynamic Host Configuration Protocol server ← they pick the IP address for computer
— Before this, system administrator who manually assign you the address
DNS
— Domain Name System
— you would not type in the IP address for the web server
— translate teh IP addresses to more memorable names that are more human-readable


You would not use the yellow page to do it.
DNS is the local yellow pages but there are indeed no one whole DNS for entire world. It has small DNS system that updates the local DNS and then grouped into the large one.
DNS is like a library that have a copy of yellow pages (small local DNS) of the world and update with small DNS they have → DNS is decentralized

Access Points
~IP address is assigned to router ← traffic cops that allows data requests every devices connected local network to internet to be processed through a single IP address (public IP address)
~~[In IPv4, with the concept of private address ← some computer sharing the same IP address and different IP was assigned to them for internal communication ← Internet cannot speak to private address but only public one reference: https://www.avast.com/c-ip-address-public-vs-private]
~access points combine with a router, modem , switch, other technology together into a single device
~Wide-area networks(WANs) have the devices separated to maintain the large size of network to scale easier. ← one single access point is not enough

The network = the interconnection of the small networks connecting with each another
IP
(Internet Protocol)
To my knowledge, IP is how to assign IP address to the computer and how the address should be written on the packet
Interconnected network comprised of smaller networks woven together and agreeing to communicate with one another. ← internet
How do they know the communication method? ← IP (rules to follow)

Large amount of data required to be transmitted physically

Obviously, too much wires are required to connected them together.
Then how? Routers acts as intermediates. Each network connects to limited amount of routers (and routers are interconnected and router build in with how to move information towards the destination of information? → routing table) → like recursion: move your one steps closer to the destination
For IPv4, the n.x.x.x ← n is the network number of router connecting

Above is applied in large scale ← for small scale will be too inefficient
One big block of data will slow down the transmission of data → put them down into packets (small cars) (will be easier to recover if error happen)
IP: sending information from A to B + breaking data into smaller pieces
IP is known as Connectionless protocol: no need to have defined path from sender to receiver → if traffic jam happened, the transmission could be changed and routers can be more responsive .
TCP (Transmission Control Protocol)
Multiple service running in a single machine
directing the transmitted packet to the correct program on the receiving machine.
Where is receiver is and what the packet is for ← TCP/IP
TCP guarantees the delivery of packets ← IP don’t do (it just care the computer transport information to the correct network)
How?
— couple the IP address with port number ← machine use this to identify the service, utility, program
Port number along don’t have meaning, but with IP address of machine, it will provide meaning.
It also tells how many packets the data were split into + the order of the packet (for reconstruction under unorder delivery)

Steps:
1. TCP break data to smaller chunks and communicates those packets to computer network software, TCP layer onto the packet
2. IP routes the packets one by one from sender to receiver ← adding IP layer surrounding the packet
3. when packet reaches the destination, TCP looks at the header to allocate the data to the corresponding program in correct order
If the delivery of the packet was dropped on the way, TCP could use additional information inside the headers to request sender to send that packet again
HTTP (HyperText transfer protocol)
dictate how information is communicated from machine to machine + application to application. Application itself has a system of rules for how to interpret the data.
HTTP ← one of application layer protocol, which contains the rules of the format by which clients request web pages from a server, and the format through which servers return information to clients.
Like if you would like to request for webpage, your format should look like this.



What if errors happen


A line of the form ← method request-target http-version
Example: GET /cats.html HTTP/1.1
HTTP/1.0 is not used anymore
GET ← making direct HTTP request
host name is included as separate line of the overall HTTP request
For the result, a status code would be shown ← varies on whether the resource exist and server is empowered to deliver that resource pursuant to clients request
How does server response?
http-version status_code
HTTP/1.1 200/ OK ← usually you won’t see it

You may go find the status code by developer tools