If I go into google browser and type in the name of a website, this is the application layer of the OSI. HTTP protocol is being used and is a request-response, so when exactly does my computer send the request to the server and when do I get the response?

I understand the encapsulation of data until it gets to the physical layer, is the HTTP request before then? If so how does it get across to the server? Thanks

  • 1
    $\begingroup$ Mh, weird questions. The request is sent when you press the Enter key in the address field of the browser. And you receive the reply when the server has sent it, it traversed the Internet and the browser rendered it. $\endgroup$
    – user16034
    Jul 3, 2023 at 13:46

1 Answer 1


How does the internet works?

I could answer this question in one sentence or we could be here for hours. But I want to keep things simple and easy to understand.

The internet is literally a mesh of wires spread around the world that connect different devices to each other. Even if you do not see a physical wire, you can imagine your smartphone connected to a WiFi router via a virtual wire that lets you talk to a Google server situated miles away from you.

When you want to send some data to a device that is connected to your personal device via the internet, you need to follow some rules. All the data transferred over the internet is binary data consist of 1s and 0s.

  1. First of all, the application being used to send data needs to communicate with the hardware on the device to send the data over the internet. Also, the hardware of the device needs to communicate with the device that is actually transmitting the data over the internet like a WiFi router.

  2. When you send a letter to a person, you label your letter with the address of the receiving person so that the letter gets delivered to the right person. Similarly, when you send some data over the internet, you need to know the address of the device that will receive it eventually.

  3. When a network application is launched in a device like a web browser or a web server to transmit or receive the data, it will listen to the internet data on a port number like 8080. The sender needs to know about the port number of the receiver device so that the data is received by the correct application and not the one that may abuse it.

These port numbers are randomly assigned by the operating system but we can force the operating system to bind an application to a certain port number.

  1. The device receiving the data would not be able to make sense of it unless it has prior knowledge of what it is looking at. The data could be an image, a song, a plain text message or an HTML document. Hence we need to tell the receiver about the data type so that it can interpret it correctly.

These four steps describe a communication model for data transmission on the internet. Each of these steps is defined by a protocol. Depending on the type of protocol, each of these steps formats the data accordingly so that the receiver can extract the data properly.

There might be more steps in a particular model depending on the use case of the data transmission. You can read about the OSI model which can be used by anyone to transmit data over the internet or Local Area Network (LAN).

If we inspect these steps carefully, they form a pipeline where data from one step is sent to the other step for further processing until it gets transmitted over the internet. However, the layer would be the most suitable word to describe each step and we will soon learn why.


TCP/IP Communication Model

The Transmission Control Protocol (TCP) is the transport layer protocol in the communication model we saw earlier while Internet Protocol (IP) is the internet layer protocol.

These protocols together drive most of internet communication. At this very moment, your browser is using the TCP/IP model to load this webpage from a server. Hence, these together form the internet protocol suite.

enter image description here

In the above communication model (left side), the application layer gets the data from a source (like internal storage or RAM) and wraps some headers of a particular protocol like HTTP. This creates a data package of the HTTP protocol and can be read by an application that can understand it like a web browser.

This HTTP application data is sent to the transport layer. The transport layer wraps the package with TCP protocol headers along with the source and destination ports. The source port is the port of the application transmitted the data (like a web browser) and destination port is where the application running on the receiving side will receive it.

This TCP segment is received by the internet layer which wraps some IP protocol headers with source and destination IP addresses. The source IP address is the IP address of the sender device while the destination address is the IP address of the receiver device.

An IP address is a unique number allocated to a device on the internet. You can read more about IPV4 and IPV6 IP address formats. The IP address of a device can be known prior to the data transmission or can be resolved from a DNS server using the domain name contained in the HTTP header.

Once the segment is stamped with IP protocol, it becomes a network packet that is good enough to be transmitted over the internet. This is the last step of the virtual layers (processed by a computer program).

The last link layer is a physical layer on the device. This is a hardware part like the Network Interface Card (NIC) on your device which takes the packet and adds the source and destination MAC addresses to it.

The Media Access Control (MAC) address is the unique address of a hardware part provided by the equipment manufacturer. Using MAC addresses, communication between two devices becomes possible.

Once the packet is labeled with source and destination MAC addresses with some additional headers of a data transmission protocol (like Ethernet) it becomes a data frame, it can be sent to the internet communication device like a WiFi router or Satellite Dish that will take care of the transmission over the internet.

Once the data frame is received at the receiving end (right side of the diagram above), it will be peeled like an onion until the original data (the HTML document) is recovered.

The data is extracted successfully without any misinterpretation, one layer at a time, by looking at the protocol of that layer. Once the original data is extracted, it can be consumed by the correct application.

For example, if a server sends an HTML page using the HTTP protocol, a web browser is fully capable of understanding a package of an HTTP protocol and extracting the HTML page. This HTML document will then be rendered on the screen by the browser.

The HTTP protocol can also be used to transmit data other than HTML pages. The Content-Type header of the HTTP protocol is used by the application like a browser to understand the MIME type of the content.

If the receiver wishes to send the data back, it can use the source address of each layer provided by the sender to successfully send the data back in the same manner.


  • $\begingroup$ "packet", not "package" $\endgroup$
    – D.W.
    Jul 3, 2023 at 16:46
  • $\begingroup$ @Alok Maity Thanks this was very useful $\endgroup$
    – ED2468
    Jul 3, 2023 at 20:29
  • $\begingroup$ @ED2468 please accept the answer otherwise it's keep popping forever and looking for an answer. $\endgroup$
    – S. M.
    Jul 3, 2023 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.