Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 22, 2022 06:38 am GMT

Computer Networks simplified!

How do two devices on the internet send data between them?

Well, to answer this question we need to understand computer networks. In this blog, we will briefly discuss the entire process.

Before we get into any lower-level details, let's first get an overview of the process, and then we'll dwell deep after that.

The OSI reference model

This is a proposed conceptual model that characterizes and standardizes the communication functions.

The 7 proposed layers:
  1. Application Layer
  2. Presentation Layer
  3. Session Layer
  4. Transport Layer
  5. Network Layer
  6. Datalink Layer
  7. Physical Layer

Let's look at each one in detail.

1. Application Layer

In the application layer, there are a bunch of protocols that are used for various tasks.

Protocol: is a set of rules agreed upon by all parties for some process.
Examples of protocols in the application layer: SMTP, HTTP, HTTPS, Telnet, RDP, etc.

For example, outlook may use SMTP(Simple Mail Transfer Protocol) to send and receive emails, and all this happens at the application level. So an application manages these protocols. For example, a browser like firefox has to support this protocol for things to work. The same concept applies for HTTP and https(which are already baked into browsers).

2. Presentation Layer

Some very important services like translation, data compression, encryption, etc are provided by this layer. Again,

  • Translation - From Unicode(text) to binary.
  • Compression - Usage of an algorithm like Huffman encoding to compress binary data
  • Encryption - Passwords etc (SSL)... and many moreAll of this buzz happens at the presentation layer. Perfect naming for the layer, lol!
3. Session Layer

Establish, Manage, and terminate connections between services. Examples: Authorization, Authentication, Sessions.

Note: Did you ever observe that modern browsers provide functionalities of all the above layers?

4. Transport Layer
  • Segmentation: data is broken down into segments and sent over the network.

  • Flow Control: devices may have different networking capabilities and maybe one device can operate faster(like send data at 100mbps) than the other(10mbps). Well, the transport layer takes care of this problem. We will know how soon, promise : )

  • Error Control: while transferring segments, some segments may get lost! Again, the transport layer got our back. It uses checksums to find such errors in transmission.

  • Port numbers: Many applications on our device may be using the internet. The segments may get confused when they reach the device as they don't know their destination application. To avoid this confusion, we assign port numbers to applications as well as to segments before sending them from the source. So when a segment reaches a destination device it knows which application it should go to.

Finally a segment looks like this (source port + destination port + sequence number + acknowledgment + length) Wireshark example: Src Port: 6648, Dst Port: 443, Seq: 24, Ack: 251, Len: 23

5. Network Layer

After segments are made we attach some more information to the segment that is the source IP and destination IP. Just like the port number which helps segments to reach a particular application on the destination device, IP address is helpful in reaching a particular device on the network.

segment + source and destination IP is called packet. IP address is just 32 bits which can uniquely determine about 4294967296 devices, but I'm sure there are more devices than that number

As there can be many devices on your network like your phone, pc, laptop. Each of them has a unique address and thus the network layer takes care of it. Make sense? cool.

IP(Internet Protocol) is again just unique over a network but not on the whole internet. We will know more about it in further blogs.

Routing, DNS, Masking are also functionalities provided by this layer.

Routing: helps in the path determination of packet. DNS: it is a map of key-value pairs. example: www.google.com may also have an IP(like 192.168.32.3 and changing) but who can remember it all the time? so www.google.com is mapped to some IP address for ease.

6. Data Link Layer

As we already discussed IP addresses are just unique over the network but not over the internet we need one more level of uniqueness(remember there are millions of devices!). We use the MAC address which is 48 bits! and every device which has networking capabilities have their own unique mac address on the entire internet. phew!!

Now, the frame is a combination of packet + source and destination mac addresses + some extra tail data(some more checksum to avoid data loss at this level).

some more functionalities provided by this layer are:

  • Access to media: Determination of media for transfers (wired, wireless, optical, etc)
  • Media-Access Control: avoiding collision over the media, mac address takes care of this.Error detection: tail data is used to perform checksum here. Read more about checksum
7. Physical Layer:

Bit level data transfer happens at this layer, i.e bits are converted into some form like signals, light flashes or radio signals and then transmitted. We won't discuss much of physical layer as I don't think it is that important for Software Engineering. If you are interested in exploring, be my guest.

  • Transmission Media:

    • Guided - There is physical medium like wires(co-axial, twisted pair cables) on which transmission takes place.
    • Unguided - Medium of transfer is air, examples are Wifi, infrared and radio signals.
  • Transmission Modes:
    When two devices are connected over a medium we can have three modes of transmission

    • Simplex: Data can flow only in one direction.
    • Half-duple: Data can flow in both directions but not at the same time.
    • Full-duplex: Data can flow in both directions and simultaneously

I would highly recommend you to read about Manchester encoding and differential Manchester encoding to get an understanding of how signals can carry bit information.

Finally, data reaches from the application layer to the physical layer and then sent over to another device. Now data is decoded backward. i.e going up from the physical layer to the application layer. It is just amazon delivery. Packing and boxing everything to unboxing. Just relate and you will be surprised. We will dive deep soon, hopefully! See you again!

Visit my personal blog at: https://rahilrehan.github.io/


Original Link: https://dev.to/rahil_rehan/computer-networks-simplified-4koa

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To