Differences between the TCP protocol and the UDP protocol
Whether connection-oriented connection oriented non-connected
Reliable unreliable transmission reliability
Applications transmit small amounts of data in large amounts of data
Slow speed
TCP requirements and server remain connected UDP does not require TCP data to be ordered (first written data is sprints first received) UDP data is unordered
Asyncsocket is a set of open source libraries designed for socket sockets under iOS, which encapsulates the CFNETWORK/BSD socket, provides an asynchronous development model and a simple development interface that supports TCP/UDP, supports UDP broadcasts, multicast
Asyncsocket support for Gcd/blocks and Runloop modes also supports arc
1.TCP (transmission Control Protocol, transmission Protocol) is a connection-based protocol, which means that a reliable connection must be established with the other party before the data is formally sent and received. A TCP connection has to go through three "conversations" to build it up, Let's take a look at the simple process of these three conversations: 1. Host A sends a connection request packet to Host B, 2. Host B transmits a consent connection to host A and requires synchronization (synchronization is two hosts one in the sending, one in the receiving, coordination work) packet; 3. Host A then sends a packet to confirm that Host B requires synchronization: " I'll send it now, and you go ahead! ", this is the third dialogue. Three times the purpose of the "conversation" is to synchronize the sending and receiving of packets, and after three "conversations", host a formally sends the data to Host B.
2.UDP (User data Protocol, Subscriber Datagram Protocol) is the protocol that corresponds to TCP. It is a non-connected protocol that does not establish a connection with the other, but sends the packet over directly! UDP is suitable for applications that only transmit large amounts of data at a time and do not require high reliability.
Differences between the TCP protocol and the UDP protocol