We usually visit a website through a URL, so what happens when the browser enters the URL, and how does the page appear?

In fact, the websites we visit are file resources on a specific server. When we enter the URL, we are actually making the request as a client. This request is the HTTP protocol. Hypertext Transfer Protocol (actually hypertext transfer, by convention). The server returns the specified information on request. HTTP versions range from 0.9 to 2.0, with the current mainstream being 1.0 and 1.1.

Basic NETWORK TCP/IP

In fact, I think these protocols are essentially designed to solve communication problems. TCP/IP is a general name for various protocols. There are all sorts of things in agreements.

The TCP/IP protocol family structure includes the application layer, transport layer, network layer, and link layer.

  • The application layer, which determines the activities that provide service communication to users. FTP, DNS, and HTTP also belong to this layer.
  • The transport layer, as the name suggests, provides data transfer between two computers in a network link. TCP, UDP
  • The network layer, which handles packets (the smallest unit) that flow over the network. Provides a transmission route to the destination computer.
  • Link layer, the part of the network that deals with hardware links.

When the client sends an HTTP request, it is in the application layer. At the transport layer, the data is segmented, so it comes out with IP packets, and marks the serial number and port number on the segmented packets, and then continues down. The network layer loads the packet to a destination, usually a MAC address. As cs professionals know, the MAC address is unique. At the network level, data, like pork, has its location and where it is destined to be sold. Servers are layers of reverse operation. So you can receive the data.

IP, TCP, and DNS

TCP/IP protocol

You can see from the above figure that IP protocol belongs to the network layer. The IP is a protocol, not an IP address. The function of IP protocol is to send various packets to the destination. It needs to be delivered exactly to a destination. IP addresses and MAC addresses are required. The MAC address is changeable, and ARP can find out the MAC address based on the IP address. Since MAC addresses are unique, why do you need IP addresses? See the picture below.

Because actually the network environment is very complicated, not like the LAN. The router can perform transfer operations.

TCP A reliable protocol

TCP at the transport layer. The transport layer divides the message, and the reliability is mainly reflected in the three-way handshake strategy, which is examined with eyes closed. As shown, if this process is not complete, the client sends again.

DNS

The Domain Name System (DNS) is also at the application layer. Provides domain name to IP address resolution. So it should be clear by now that we typed the domain name and it turned out to be resolved to an IP by DNS.

Various protocols and HTTP relationships

You can look at the diagram and understand the layers clearly. The whole network process is clear.

The URI and URL

Uris remember back in school the teacher specifically emphasized this, uniform Resource Identifier. A URI is an identifier for the location of a resource represented by a protocol scheme. HTTP or FTP is just a way of locating resources, not a specific location.

Urls understand the location of resources on the network.

This diagram shows the absolute URI format

If there is a mistake, see officer many correct, with a praise bai, pro. In addition, MY wechat public account will gradually release front-end things, and I hope that those who learn front-end can follow a wave of Moomoocode.