When you click on a URL in your browser, the following happens according to the Open Systems Interconnection (OSI) model:
Application layer
The browser parses the URL to determine the protocol, host, port, and path. The protocol is the type of communication that will be used, such as HTTP or HTTPS. The host is the name or IP address of the computer that the browser needs to connect to. The port is the number that the browser uses to identify the specific application on the host that it wants to connect to. The path is the location of the resource on the host that the browser wants to access.
For example, when you click on the URL https://www.learnwithisrak.com/
, the browser parses the URL as follows:
- Protocol: HTTPS
- Host: www.google.com
- Port: 443 (the default port for HTTPS)
- Path: /
The browser creates an HTTP request message, which includes the URL. The HTTP request message is a text message that tells the web server what resource the browser wants to access.
For example, the HTTP request message for the URL https://www.learnwithisrak.com/
would look like this:
GET / HTTP/1.1
Host: www.learnwithisrak.com
The browser sends the HTTP request message over the TCP connection.
Transport layer
The TCP layer breaks the HTTP request message into smaller packets. TCP packets are typically around 1,500 bytes in size.
The TCP layer assigns a sequence number to each packet. This allows the TCP layer to reassemble the packets in the correct order on the receiving end.
The TCP layer sends the packets over the network. The TCP layer will retransmit any packets that are lost or corrupted.
Network layer
The IP layer adds the source and destination IP addresses to each packet. The IP address is a unique identifier that is assigned to each device on the network.
The IP layer forwards the packets over the network. The IP layer will use a routing table to determine the best path for the packets to take.
Data link layer
The data link layer adds the source and destination MAC addresses to each packet. The MAC address is a unique identifier that is assigned to each network interface card (NIC).
The data link layer transmits the packets over the physical layer.
Physical layer
The physical layer converts the packets into electrical signals and transmits them over the network medium. The network medium could be a cable, wireless signal, or other type of connection.
Receiving end
The same process happens in reverse on the receiving end.
- The TCP layer on the receiving end reassembles the packets into the HTTP request message.
- The HTTP layer on the receiving end processes the request and sends back a response message.
The response message is a text message that contains the resource that the browser requested. For example, the response message for the URL https://www.learnwithisrak.com/
would contain the HTML code for the Google homepage.
The browser on the sending end receives the response message and displays the requested web page.
Additional details
The browser may cache the HTTP request and response messages. This means that the browser may store the messages on the local computer so that it can access them more quickly in the future.
The browser may use a proxy server to access web pages. A proxy server is a computer that acts as an intermediary between the browser and the web server. The proxy server can improve performance and security.
The browser may use encryption to protect the HTTP request and response messages. This is especially important when using HTTPS websites.
The OSI model is a complex topic, but it is important to understand the basics of how it works in order to understand how data is communicated over a network.