The premise
Client: Enter the URL
Server:
- IP address: Both lans and the Internet are assigned a unique identity, which can be assigned automatically. If two are the same, only one can be connected, Internet is the same, can find you according to the IP address (××× ××× ××× ×) (find a computer).
- Domain name: semantic, associated with IP address, IP address can be found according to the domain name, HTTP protocol port is 80, HTTPS protocol port is 3306, domain name resolution (find a specific program of a computer)
- Port number: a computer will run more than one program, each program needs to occupy the port number when the computer runs, (there is a program occupy more than one port, if one program is occupied, no other use, later set port 81)
Enter the URL, what’s going on in the background
1. Domain name resolution
The browser first queries the hosts file on the local disk C. If the IP address is obtained from the hosts file on the local disk (if it is not configured, there is no IP address, which is often modified by hackers)
If you do not get the corresponding IP address based on the DNS server, (if you do not have a 404 page)
2. Obtain the IP address
// Domain name: port /path/#has(hash)? // path/#has(hash)? (Query string)
2.1(Three-way handshake) Establish a connection
3. The server searches for the corresponding resource (HTML, CSS, JS,img, data) according to the requested URL address to find the corresponding resource in the corresponding directory, 404 is not found
The server sends the resource response to the browser, index.html(received with four waves)
Browser RENDER (redraw and reflux)(DOM tree RENDER tree, virtual DOM)(page optimization)