Scoket understanding Flowchart

Source: Internet
Author: User

Scoket flowchart: three handshakes of TCP in the socket to establish a connection flowchart: it can be seen that when the client calls connect, a connection request is triggered and a syn j packet is sent to the server, at this time, connect is blocked. The server listens to the connection request, that is, it receives the syn j packet and calls the accept letter to receive the request and sends the syn k, Ack J + 1, at this time, the accept enters the blocking status. After the client receives the syn k, Ack J + 1 from the server, connect returns the result and confirms the syn k. When the server receives the ACK k + 1, accept is returned. The three handshakes are completed and the connection is established. Conclusion: the client's connect returns the second time of the three-way handshake, while the server's accept returns the third time of the three-way handshake. The four handshakes of TCP in the socket to release the connection flowchart:
  • An application process first calls close to close the connection, and TCP sends a fin m;
  • After receiving the fin m, the other end performs passive shutdown to confirm the fin. Its receipt is also passed to the application process as a file Terminator, because the receiving of fin means that the application process can no longer receive additional data on the corresponding connection;
  • After a period of time, the application process receiving the file Terminator calls close to close its socket. As a result, TCP also sends a fin N;
  • The source sending end TCP that receives the fin confirms it.

In this way, there is a fin and ACK in each direction.

Scoket understanding Flowchart

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.