TCP establishes a connection why three handshake instead of two times handshake

Source: Internet
Author: User
The reasons are explained in the computer network (Shehiren translation):
1. Two handshake, then if the client to the server-initiated package A1 if the fault in the transmission link, resulting in the transfer to the server time is rather lag, in this time period because the client did not receive the server for the package A1 confirmation, then will retransmit a packet A2, Assume that the server received the A2 package normally, and then return to confirm the B2 package. Since there is no third handshake, the client and server have already established a connection. Assuming that the A1 package is then uploaded to the server in the link, the server will return the B1 package confirmation, but because the client has cleared the A1 package, the client discards the confirmation packet, but the server maintains the equivalent "zombie" connection.
So by shaking hands twice, it is possible to waste server's network resources.


Image explanation:

1, the client sends an ambiguous message to the waiter
2, the waiter received, read the news, very happy, immediately reply (at this time the customer does not know the service received)
3, the customer is particularly pleased to receive the waiter relationship confirmation of the message, (but the waiter did not know that the customer received, if not received a repeat, theoretically, until the =-=)
4, the waiter finally received a customer relationship confirmation message, suspended Heart finally put down
5, so the customer and the waiter really built a reliable channel, after all, both know that it is a good way ...

So it takes at least three times to confirm the relationship.



Without three times, the server cannot determine if the client has received his or her message
If not, the client may not have received it at all, or the client responded, but the server did not receive

If you've used a walkie-talkie, you'll understand:
C->s: Can you hear me?
S->c: Hear. Can you hear me?
C->s: Hear.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.