What is TCP?
TCP is a connection-oriented, reliable, IP(byte stream) – based transport layer protocol
TCP is the underlying protocol of HTTP
A complete HTTP request process (inputwww.baidu.com
, to the page rendering process)
- The input
www.baidu.com
, and press EnterThe DNS
, get the IP address; - Based on the IP address, find the server and go
Establishing a TCP Connection
, three handshakes; - The browser
Sending an HTTP request
, the server performsThe response
HTML file; - The browser
parsing
The HTML file,loading
Resources needed in HTML files (images, CSS, JS); - The browser completes the page parsing
Apply colours to a drawing
; - The HTTP service was released. Procedure
Closing a TCP Connection
Four times.
Triple handshake (essentially: initiation of connection + two confirmations between two parties)
Four times to wave
In fact, A will continue to wait for 2MSL before disconnecting.
Note: The initiator of the three-way handshake and four-way wave can be either the client or the server