TCP protocol and three-way handshake

TCP: Transmission Control Protocol. (Transmission Control Protocol). It is connection-oriented, reliable, and based on byte stream communication protocol.

Reliable, if a packet is lost, it will be retransmitted.

UDP: User Datagram Protocol (User Datagram Protocol), which is a non-connection-oriented, unreliable connectionless communication protocol.

TCP:

Before transmitting data, a three-layer handshake must be performed, and the message will not be sent until the connection is confirmed to be ok. ————————Send information like the previous war.

After transferring data, it must be completely disconnected after four waved hands.

To put it bluntly, the so-called three-way handshake is:

3 handshakes: (anthropomorphic) (the bottom layer is the serial code or something)
    the first time: the client initiates a request and asks: "Are you there?"
    The second time: the server answers after receiving it: "Yes", and will attach The message just received : "Are you there?"
    The third time: After the client receives the message fed back by the server:
        first reply: "Okay, we can communicate" and attach the message just received: " In"
       and check whether the message received by the server just now is the same as the one you sent , if it is the same, confirm that the message channel you sent to the other party is normal

    After the server receives the response message from the client, it confirms whether the message received by the client is the same as that sent by itself. If it is the same, it confirms that the message channel it sends to the other party is normal.

4 waved hands:
    1st time: the client said: I want to quit
    the 2nd time: the server said: OK, wait a moment, I will send you the rest of the data,
                   I am ready, close the data Receive channel, no longer accept your data.
                   You can close your output channel.
    The third time: The server said: The data is sent, I am ready, close the data transmission channel, and will not send you any more data.
                    You can close your receive channel.
    4th time: Client: OK, bye.

Guess you like

Origin blog.csdn.net/sslovly/article/details/125249154