Python socket programming 2: socket and tcp three-way handshake, pythonsocket

Source: Internet
Author: User

Python socket programming 2: socket and tcp three-way handshake, pythonsocket

To establish a TCP connection, you must go through the "three-way handshake ":
The first handshake: the client sends the syn Packet (syn = j) to the server and enters the SYN_SEND status, waiting for confirmation from the server;
The second handshake: when the server receives the syn packet, it must confirm the customer's SYN (ack = j + 1) and send a SYN Packet (syn = k), that is, the SYN + ACK packet, the server enters the SYN_RECV status;
The third handshake: the client receives the server's SYN + ACK package and sends the ACK (ack = k + 1) Confirmation package to the server. After the package is sent, the client and server enter the ESTABLISHED status, complete three handshakes.

Which step of the socket has undergone three handshakes? See:

That is, it occurs in the client, address = server. in accept () and client connect (), a connection object is generated after three handshakes. Subsequent recv () and send () are the real data receiving/sending.

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.