ios-Network access principle and the difference between TCP and UDP

Source: Internet
Author: User

Three-time handshake process
First time
First handshake: When a connection is established, the client sends a SYN packet (SYN=J) to the server and enters the syn_sent state, waiting for the server to confirm; SYN: Synchronous sequence Number (Synchronize Sequence Numbers).

Second time
Second handshake: The server receives the SYN packet, it must confirm the customer's SYN (ACK=J+1), and also send itself a SYN packet (syn=k), that is, the Syn+ack packet, when the server enters the SYN_RECV state;

Third time
Third handshake: The client receives the server's Syn+ack packet, sends the acknowledgment packet ack (ACK=K+1) to the server, and the packet is sent, the client and the server enter the established (TCP connection succeeded) State and complete the three handshake.


The connection process is similar to the following:
"I want to send you the data?" 」
"All right, I'm ready, right?" 」
"ok I want to send you data, you are ready to receive. 」
And then it's on the chatter.
#


The difference between TCP and UDP
1. Connection-based and no-connection
2. Requirements for system resources (more TCP, less UDP)
3.UDP program structure is relatively simple
4. Stream mode and datagram mode
5.TCP guarantees data correctness, UDP may drop packets, TCP guarantees data order, UDP is not guaranteed.

ios-Network access principle and the difference between TCP and UDP

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.