DEV Community

Cover image for Protocols and how they work

Protocols and how they work

Disclaimer: This is an introductory article made by someone who's studying this subject, if you have some advice about the topics that are covered in here, DM me! We can have a chat and i'll be pleased to change this article. Thanks for reading!

After my last article about deploys and how they work (only an introduction about that topic), i started to study more about network and how we can connect our devices with another devices, and exchange data between them, of course.

I intend to do a series (don't know how many articles it will be) of articles about protocols and how they work individually, by the end of the series you might have a good understanding about how the internet works with all of these protocols working together, making a deploy look like child's play.

For this matter i'll be using the two most used models, the TCP/IP and OSI model, as both of them can be used as reference models, it'll help us understand the data flow within any type of network.

I've already knew OSI model from previous studies but it wasn't something that caught my attention, even TCP/IP, which is the backbone of our network communication didn't grab my attention, until now. Thus, i have decided to make some articles about some protocols that we already know, but showing - or trying to - how things work within the OSI and TCP/IP model.

OSI and TCP/IP stack

Both models are structured with layers, the OSI has 7 layers that correlates with the 4 layers of TCP/IP model, because both of them can be used as reference models.

OSI and TCP/IP models

First, let's go through what protocols actually do and why we call them a stack.

Protocols are basically an agreement between two or more hosts to establish some standards for this communication to happen, the stack is created so we can have a reference for the multiple stages in this conversation, and troubleshoot any issues that might show up. We can say that a protocol stack is the one that contains all the protocols, or services, that are needed for hosts to communicate with each other.

Furthermore the stack also represents the isolation between layers, so each layer will communicate with the same layer in the other host and will pass through the same stages using the same protocols, the isolation between layers is used so that the upper layers don´t have to occupy themselves with some services that are being executed on the lower layers.

Ok, but what these layers actually do?

The 1st layer of the stack is the physical layer and at this point i think that everyone knows how data is physically transmitted, doesn't matter what is the medium used, the computer will always see bits flowing.

The 2nd layer is responsible for transforming the transmission received, break into smaller pieces making data frames (hundreds or thousands of bytes) and transmitting the frames sequentially, the receiver can send back an acknowledgement frame to confirm that he has received the data frame correctly.

3rd layer might be the most famous one, it is the layer responsible for routing data through networks, besides that, it is responsible for dealing with congestion and the quality of the service offered by other layers, the network layer must assure that the correct protocols are being used. The data in this layer is called packets.

4th layers is the most challenging for me, specially because it's here where the magic - or the isolation - happens, this layer is responsible for isolating the communication process between the upper and lower layers, therefore it needs to put everything in order, so it must reorder every data received and handle the communication with care. This is a layer that must establish a connection that aims directly to the other machine, so it is a "direct" connection between two hosts, because the lower layers will handle the communication between the host and the next immediate host, so it could be a router, a switch or an access point, but the 4th layer will handle the communication between the host and the final destination.

The last 3 layers represents just 1 layer of the TCP/IP stack, and why is that? Well, that's an interesting topic, but we'll not deal with that right now, so let's keep moving.

The session layer is mainly responsible for taking care of the session tokens, like keeping track of whose turn it is to transmit data, will also manage this tokens so the two parties won't even attempt to send data without the token, and last but not least, making sure that the data that has been transmitted is in order even if a crash occurs during the data transmission.

Almost reaching the peak of the model we have the presentation layer, this layer we can look at him more like a support role, because it will help the application layer to communicate with some services offered by the session layer, it is through this layer that the session layer knows which services it needs to provide to keep the data flowing.

Last, but definitely not least, we have the application layer that have the duty of provide access to other services within the OSI model, it does that by using an interface that allows the end user to communicate with other services, all of the data generated with this input will be used by some other tools that will establish a connection with the layer below, then follow the process until it reach the other host.

To be continued...

This may sound confusing right now, but i'm sure that will help a lot with the understanding of the protocols that will be presented to you throughout your career as IT professional, because this layers can be seen by every communication process in a network, as i said at the beginning of this article, these are reference models, so it won't show you the answers about how an specific protocol work, but will definitely show you which rules the protocol has to follow to be part of some layer, or what functionalities some protocol have just for being part of any of these layers.

The next article will treat the communication process within a LAN, which is a local area network, how the data flow works and the responsibilities for every component, it'll give a better understanding about how reference models can be applied to real scenarios.

References

Tanenbaum, Andrew S. Computer Networks. 5th ed. Upper Saddle River, NJ: Prentice Hall, 2010.

Piscitello, David M., and Chapin, A. Lyman. Open Systems Networking: TCP/IP and OSI. Upper Saddle River, NJ: Addison-Wesley, 1993.

Top comments (3)

Collapse
 
kecbm profile image
Klecianny Melo

High quality article! Addressing several subjects that are new to me. Thank you for sharing @nikolai1312 😁

Collapse
 
anthonyvii profile image
Anthony Vinicius

Wow! Nice article, Nicolas! Protocols are a theme that I enjoy reading about. Amazing job!

Collapse
 
ryan_gozlyngg profile image
!Ryan Gozlyngg

And that's why I love computer network. We'll wait for the next article!!!