Enter the URL of the page to open

Enter the url, web page to fully open?
    First read cache, search your DNS cache, find the IP address directly access
    1.DNS resolved
        by the DNS server to resolve a domain name corresponding to the IP address of the server to be
    2.TCP connection
        know the server after the IP, the protocol requires three-way handshake to establish a connection, sends three packets
        to confirm both the sending and receiving capabilities are normal, specify your own initialization sequence numbers
        essence connect to the server specified port, TCP connection is established, the serial number of simultaneous connections on both sides and confirmation number
        to start the client: closed server: the listen
            1. the first handshake
                client sends a SYN packet and indicate their initialization sequence number ISN to the server
                client enters SYN_SENT state
                with part of the header SYN = 1, initial the X-number = seq
                SYN segment = 1 can not carry data, but it needs to consume a No.
            2. the second handshake
                after the server receives a client's SYN packet to its own SYN packets as a response
                to specify your own initialization sequence No. ISN (s), the client ISN + 1 as the value of ACK
                this time server SYN_RCVD state
                Segment acknowledgment packet SYN = 1, ACK = 1, an acknowledgment number ack = x + 1, Y = initial sequence number SEQ
            4. third handshake
                after the client receives SYN segment, continues to send an ACK packet, the value of ISN + 1 to the server
                the server in the ESTABLISHED state
                after the server receives the ACK packet also enters the ESTABLISHED state
                acknowledgment segment ACK = 1, an acknowledgment number ack = y + 1,. 1 + X = number SEQ
                ACK segment may carry data, the data is not consumed number not carry
    3. send request
        HTTP request
    4. Accept response
        server accepts the request and returns the HTTP packet
    5. the server process determines whether the code according to the normal state is returned
    6. browser to render the page
        return after the success of the code to get the browser requests a page, it parses out the renderer
        1.HTML mark
            calling HTML parser to build a DOM tree and Token
        2.style/link mark
            invoked CSS parser handle CSS markup and build CSSOM tree
        3.script mark
            JS parser calls, deal with JS code, binding events, modify the DOM tree and CSSOM tree
        will be merged into a tree two tree rendering
        is calculated based on the layout of the render tree, each node to calculate the geometric information
        to draw a page based on the calculated information
    7. disconnect
        Similarly disconnect a connection requires four waved
            1. the first wave (client: I think disconnected)
                client sends a FIN packet, the packet sequence number specified in a
                client in FIN_WAIT1 the state
                is sending a connection release segment (FIN = 1, number seq = u)
                to stop sending data, take the initiative to close the connection
            2. The second wave (the server: do you want to disconnect it)
                after the server receives FIN, will sends an ACK packet, and the sequence number value of +1 as the client ACK packet sequence number of
                the server in the CLOSE_WAIT status
                is sent after the server receives a connection release segment acknowledgment segment
                TCP half-closed, connection release
                client after receiving confirmation service terminal, enter FIN_WAIT2 state
                waiting for the server makes a connection release segment
            3. Third Wave (server: I would like disconnected)
                server also want to disconnect, and sends FIN packets to the client to specify a serial number
                server in LAST_ACK state
            4. Fourth Wave ( client: initiating a confirmation)
                after the client receives FIN, as sends an ACK packet as a response, the server sequence number value as the sequence number value of their own +1 ACK packet
                client TIME_WAIT state, to ensure that the server received own ACK packet will enter CLOSED state

Published 27 original articles · won praise 4 · Views 494

Guess you like

Origin blog.csdn.net/qq_45517916/article/details/104611841