Systems that are open for communication with other systems.OSI is developed to communicate with computers with each other.
OSI Model (7 Layers) -
Application layer - The application layer contains the application. So when you send the data over, It ensures an application can effectively communicate with other applications on different computer systems and networks. The application layer allows users to send each other files/data/messages through a network.
Presentation layer - The presentation layer takes the data whatever your message/file/data you trying to send to your friend in another country/another computer/network. It will get the data in the form of Text/Images/Numbers/Characters etc. So the presentation layer converts these Text/Messages/data into a machine-representable data format. Converts ASCII code to EBCDIC. This is known as translation.
A few things happen, Before the data is transmitted further it goes under encoding, encryption and changing the data. So it is only readable to the person whose data was sent to. Data compression can be used here. So it is easier to transport. Cryptography is frequently required for privacy and authentication. Here SSL protocol is used for encryption & decryption. Then the data is sent to the Session layer.
Session layer - Session layer protocols help us to set & managing the connections & it enables the sending & receiving of data followed by the termination of the connected session. Before the session establish it will do sets the authentication in the server. Many times it asks for a username and password. This layer allows users on different machines to establish active communication sessions between them.
for e.g - When you shop online there's a session being created for your computer and the shopping website /app server. When all things payment etc is done it logs you out. That's the work of the session layer. Now the data is transferred from the session layer to the transport layer.
Transport layer - The transport layer has its protocols, How the data will transport like UDP & TCP.
Segmentation - Data that will be received from the session layer will be divided into small units called Segments. Every segment contains the source and destination port numbers & sequence numbers. (Sequence number helps us to resemble the segment in ascending order). We all know the data will not be sent at once it will be transferred into chunks and it has sequence numbers.
Flow control - the transport layer controls the amount of data that is being transported. If the server sends at 40mbps but the client is received at 20mbps. So that's not going to work. So it is like - Hey, Slow down.
Error control - Some packets get lost or corrupted data.
Connection Oriented Transmission - (TCP) & Connectionless Oriented Transmission called UDP.UDP is faster than TCP because it doesn't give feedback about the data being lost or not. Some of the data packets get lost in the UDP. for eg Video calls. But in TCP 100% of data is transferred for eg - email, FTP, etc.
The basic function of the transport layer is to accept the data from the Session layer. Split Up into smaller units if need be, pass these to the Network layer, and ensure that all pieces arrived correctly at the other end.
Network layer - The network layer works for the transmission of received data segments from one computer to another that is located in a different network. From the transport layer, we talked about our Network. But from the Network layer, this data is communicated with other computers (outside). This is where the Router lies. The function of the Network layer - Logical address. IP address done in the Network layer is known as a logical address. We all know every Computer has its own IP address, Network layer assigns the sender & receiver IP address to every segment in the form of an IP packet, So every packet reaches its correct destination. Also, it performs routing moving one data packet from source to destination. After this data is sent to the Data Link Layer.
Data Link Layer - It allows you to directly communicate with the computer. The data link layer receives the data packet from the network layer and this data packet contains the IP addresses of both the sender & receiver
When a packet sends the data, it will have the IP address of the sender & receiver. When you receive the data at the Network layer, Now the idea is for which application to send the data. The physical address (MAC address). Now the MAC address of the sender & receiver is assigned to the data packet.
MAC address - 12-digit alphanumeric numbers of the network interface of your computer. Your computer Bluetooth may have a different MAC address, your WIFI may have a different MAC address etc. The data link layer performs two functions. It will allow the upper layer of the OSI model to access these frames/etc & it also controls how data is placed & received from the media using something known as Media access control. Then in the end we have the Physical layer.
Physical Layer - Data that you get from the Data link layer in the forms of 0 & 1. Making sure that when one side sends a 1 bit, It is received by the other side as a 1 bit not as a 0 bit.
Another Model -
TCP/IP Model (5 Layer) -
Similar to OSI Model, it has only 5 Layers.
Application
Transport
Network
Data Link
Physical
Client Server Architecture -
Application layer -
It is the main layer where the user interacts, it consists of various applications/web browsers. for eg -WhatsApp, Browser, etc
client-server architecture - When you see the request from a particular server. They should be knowing how to deal with that request. For that, there are some rules and regulations that are known as protocols.
How do application talks to each other (in the Networking system)?
Server - System that controls your website for hosting. Now the application has 2 parts.
Server Part
Client part
These are known as processes & they communicate with each other. If you host your server then you should have some reliable IP addresses which can be reached by the clients. You also want to have high availability (to not let down the server).
- Client part -
When you request Youtube.com, like hey Youtube, Show me some videos. So here you are client and the Youtube server is the server & it sends you data back. When I am talking about Youtube, Microsoft, Google, etc. they don't have just one server they have a lot of servers. These are large-scale companies, and A lot of folks are using them. If all the folks are contacting just 1 server, The server will go down. The collection of servers in large-scale companies is known as Data centers.
Data centers? -Collection of a huge number of computers & it may have static IP addresses (addresses that do not change). They have a very good internet connection that will not go down & have high upload speed. Some companies rent their servers(Cloud Providers).
Google just don't have only one server(they have many servers).
ping google.com
ping - measures the round trip time for messages sent from the originating host to the destination of computers & that are encoded back(entire time is known as ping time). Can we reduce the ping time? No because you get the best ping time)
That's the client Server architecture. There's one more way in which applications are connected from the end system.
Peer To Peer Architecture (P2P) -
Applications that are running on various devices, get connected. So there's no one server or larger data centers etc. For eg - In your college, there are many computers & all of these are connected.
In this P2P communication, there's no dedicated server. The key advantage here is you can scale it very rapidly. It is a decentralized network.
what is the client? server? here - In P2P every single computer can be termed as a client & server as well. for eg - BitTorrent.
Protocols -
We are still on the application layer.
Web protocols :
TCP/IP :
HTTP, DHCP, FTP, SMTP(to send the email), POP3 &IMAPS(to receive the email), SSH(login into someone else computer terminal remotely), VNC(virtual network control)
Outside of TCP/IP, there are :
Telnet, UDP
Thread - a lighter version of the process. When we talked about 1 process it can have running multiple threads. Thread is doing a single job at a time.
Socket -
When you need to send a message from one system to another, you can use the socket for that. A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent.
Ports -
Ports tell which application we are using. Now there's a possibility may be many processes are running on a single application like many Chrome windows are open etc. Now it is like the data that 'Abhi' requested needs to go to google chrome but which instance of google chrome/which process of google chrome like tab1/tab2/tab3..? How do we determine this thing? There's a thing for that called Ephemeral Port(dynamic port).
Port 80 is reserved for HTTP applications internally it assigns itself random port numbers. It works as if multiple tabs/windows/processes running in an application. Once the process is done it will be freed. Ephemeral ports can exist on the client side, but on the server side, you have to know the port number.
HTTP -
It is a client-server protocol. It tells us how you request this data from the server & it also tells us how the server will send the data back to the client. So when you as a client request to the server this is known as an HTTP request & server sends back the response to the client(called HTTP response). These are application layer protocols. So every application layer protocol also requires some transport layer protocols. HTTP uses TCP(inside). HTTP doesn't store the states. It is a stateless protocol. So the server will not store any information about the client by default.
TCP - Correction oriented(A connection has to be made with the server once the connection is made you can exchange the data). So in webpages, we see links/images/videos/audio/documents/etc all these things have specific URLs.
HTTP(GET, POST, PUT, DELETE) -
HTTP method tells the server what to do
GET - This means you requesting some data.
POST - Hey I am a client & I am giving something to the server.
PUT - Puts data at a specific location.
DELETE - If you want to delete the data from the server.
ERRORS/STATUS CODES -
When you send the request to the server you need some ways to know that the request is successful/fail/etc, for that, there exists a Status code. For e.g - 200 means the request was successful.
Status codes
Range in 100 - Informational Category
Range in 200 - Success Codes
Range in 300 - Redirecting Purpose
Range in 400 - Client Error
Cookies -
Unique string (stored in browser)
When you visit the application/website/browser for the first time, it will set a cookie. After that whenever you make a new request in that request header a cookie will be sent. Cookies are text files with small pieces of data — like a username and password — that are used to identify your computer as you use a computer network.
Third-party cookies - These are created by domains that are not the website (or domain) that you are visiting. These are usually used for online-advertising purposes and placed on a website through a script or tag. A third-party cookie is accessible on any website that loads the third-party server's code.
Networking Devices -
Repeater - A repeater operates at the physical layer. Its job is to regenerate the signal over the same network before the signal becomes too weak or corrupted, to extend the length to which the signal can be transmitted over the same network. An important point to be noted about repeaters is that they do not amplify the signal. When the signal becomes weak, they copy the signal bit by bit and regenerate all the original strength. It is a 2-port device.
2 Hub - It is a multiport repeater. A hub connects multiple wires coming from different branches, for eg - the connector in a star topology connects different stations. Hubs cannot filter data, so data packets are sent to all connected devices. In other words collision domain of all hosts connected through Hub remains one. Also, they do not have the intelligence to find out the best path for data packets which leads to inefficiencies and wastage.
Bridge - A bridge operates at the data link layer. A bridge is a repeater, which adds to the functionality of filtering content by reading the MAC addresses of the source and destination. It is also used for interconnecting two LANs working on the same protocols. It has a signal input and signal output port, thus making it a 2 port device.
Switch - It is present at the data link layer. A switch is a multi-port bridge with a buffer and a design that can boost efficiency (a large number of ports imply less traffic) and performance. The switch is a data link layer device. The switch can perform error checking before forwarding data, which makes it very efficient as it does not forward packets that have errors and forward good packets selectively to the correct port only. In other words, the switch divides the collision domains of hosts, but the broadcast domain remains the same.
Gateway - A gateway as the name suggests, is a passage to connect two networks that may work upon different networking models. They work as message agents that take data from one system, interpret it, and transfer it to another system. Gateways are also called protocol converters and can operate on any network layer. Gateways are generally more complex than switches or routers.
You reached the end of this Chapter 🥳
Summary of the Topic-
Here we talked about the OSI Mode and its 7 layers in brief. Then we saw there's another model called TCP/IP model which has 5 layers. Then we saw Client Server Architecture and Peer 2 Peer Architecture, then protocols, sockets, ports, HTTP and HTTP(get, post, put, delete), Error/status code, cookies and Networking devices.