OSI model – when you have two computers in some network (like, say, the internet) communicating with each other, multiple protocols are involved, most of them building off of each other. We organize these protocols into seven “layers”, with each layer serving a specific purpose:
* Layer 1 – physical – how does the computer interpret 1’s and 0’s from electricity or fiber signals?
* Layer 2 – data link – how does the computer know which machine *it is currently connected to* to send a packet to? (Example protocol: ethernet)
* Layer 3 – network – if the computer isn’t connected to the data’s destination, how does it know which machine to send the packet to so that the packet gets closer to its final destination? (Example protocol: IP)
* Layer 4 – transport – once the computer gets the packet, how does it know which process the data is intended for? (Example protocol: TCP)
* Layer 5 – session – maintains connections
* Layer 6 – presentation – ensures the data is in a readable format for whatever application it’s passed to.
* Layer 7 – application – the actual payload, which can have its own protocols based on what application you’re running. (An example is HTTP)
I’ll mention that since layers 5 and 6 don’t have many big example technologies, a lot of places teach the alternate [5-layer internet stack](https://www.educative.io/answers/what-is-the-five-layer-internet-protocol-stack) instead of the 7-layer OSI model.
TCP and IP are the two most common protocols used in the internet today. IP provides routing, pointing data to the right machine, and TCP names which process that data goes to. TCP is common because it also has the excellent benefit of *guaranteed delivery*. This is extremely difficult to write on one’s own, and TCP is a very complex protocol because of this. Though some applications opt to use UDP, which is a faster and simpler protocol, but which doesn’t guarantee delivery so packets are sometimes lost. Most applications that use UDP can handle a few packet drops.
Latest Answers