1, TCP/IP protocol is the Transport Layer protocol, the main solution to the data in the network transmission
HTTP is an application-layer protocol that primarily addresses how data is packaged
2. Three handshake for TCP connection
First handshake: The client sends the SYN packet to the server and enters the Syn_send state, waiting for the server to confirm
Second handshake: The server receives the SYN packet, must confirm the customer's SYN, and also sends a SYN packet, namely the Syn+ack packet, when the server enters the SYN_RECV state
Third handshake: The client receives the server's Syn+ack packet, sends the acknowledgment packet ack to the server, the packet is sent, the client and server enter the established state, and the three handshake is completed.
The data is not included in the packet that is delivered during the handshake, and the client and server formally begin transmitting the data after the three handshake is complete.
Ideally, once a TCP connection is established, the TCP connection is maintained until either side of the communication actively closes the connection. Both the server and the client can initiate a request to disconnect the TCP connection when the connection is disconnected, and the disconnect process requires a "four-time" handshake
3. The difference between TCP and UDP
1, TCP is connection-oriented, although the security of the network instability determines how many times the handshake can not guarantee the reliability of the connection, but the TCP three-time handshake at a minimum to ensure the reliability of the connection
And UDP is not connection-oriented, UDP transmission data before the connection with the other, the docking received data does not send a confirmation signal, the sender does not know whether it will be received correctly, of course, there is no need to resend so that UDP is a non-connected, unreliable transmission protocol
2, due to the characteristics of 1, so that the cost of UDP smaller data transfer rate is higher, because the initial data is not necessary to confirm, so the real-time UDP is better
TCP/IP HTTP socket notes