Understanding of TCP and UDP protocols

UDP protocol

Defined: the User Datagram Protocol, User Datagram Protocol.
Major role: the network data into a compressed form of data packets.
Packet Format: transmitting a binary data unit of
mechanism: reckless type.
It is simply to grab data from the application when it wants to transfer, and as quickly as possible to throw it on the network. Therefore, at the transmitting end, UDP data transfer speed is only generated by the speed of the application data, computer capabilities and limitations of the transmission bandwidth; receiving end, UDP segment to each message in a queue, each time an application from reading a message queue segment.

Advantages: faster, safer.
Compared with the TCP protocol, UDP protocol excluded reliable information delivery mechanism, which is provided to reduce the packet protocol TCP packets, sorting and assembly process requires time consuming. Secondly, UDP is a transport protocol stateless, so it is very fast when transferring data. Without these mechanisms of TCP, UDP than TCP vulnerabilities being exploited by attackers would be less.

Disadvantages: poor reliability.
UDP protocol is a connectionless transport protocol, while excluding bring the advantages of speed and reliable information delivery mechanism, obviously it reduces the need for reliability, which is the UDP protocol can not know whether its security, integrity arrive.

Application
because fewer controls UDP protocol, data transmission delay, high data transmission efficiency, reliability for less demanding applications, or may protect the reliability of the applications, such as DNS, TFTP, SNMP, etc. .
In life audio, video and data can be common for data transmission using UDP protocol, such as Tencent QQ these social networking software to use more UDP.

TCP protocol

The TCP: Transmission Control Protocol Transmission Control Protocol
major role: the data stream into segments of appropriate length after the transmission
mechanism: tight little fine type.
Connection-oriented means that the two applications using TCP (usually a client and a server) to each other before exchanging packets must first establish a TCP connection. This process is similar to making a phone call, first dial ringing, wait for the other hook to say "Hello" before explained who it was. In a TCP connection, only two parties communicate with each other. While UDP is more like text messaging, the sender all the information, the information of all children fall into the whole network thrown.

Advantages: Good reliability

  • When TCP sends a segment, it starts a timer and wait for the destination to acknowledge receipt of this segment. If you can not receive a confirmation, it will retransmit this segment. When a TCP acknowledgment is received from the bottom of the other end of the TCP connection data, it will send. TCP delayed acknowledgment function, this feature is not turned, it is immediately confirmed. Is turned on, the timer is triggered by the confirmation point in time.
  • TCP test and it will keep the header and data. This test is an end and the aim of detecting any change in the data transmission process. If you receive a section of the test and an error, TCP discards this segment and do not acknowledge receipt of this segment (want to start a timeout and resend)
  • Since the TCP segment as the IP datagram transmission, to reach the IP datagram may be out of order, so the arrival of TCP segments may also be out of order. If necessary, the data received by the TCP will reorder the data will be received in the correct order to the application layer.
  • Receiving TCP must discard duplicate data
  • Volume control. Each TCP connection has a fixed side buffer space size. Receiving TCP only allows the other end of the transmitting and receiving end can receive the data buffer. This will prevent the buffer faster host resulting in slower host overflow.

Disadvantages: slow, high system resources, vulnerable to attack
TCP before passing the data must first build connections, which will consume time, but also in the data transfer, acknowledgment mechanism, retransmission mechanism, and congestion control mechanisms will consume a lot of time.
Since each device on the need to maintain all of the transport connections, and each connection takes up a system CPU, memory and other hardware resources.
In addition, since there is an acknowledgment mechanism TCP three-way handshake mechanism, which also led to TCP vulnerable to exploitation, to achieve DOS, DDOS, CC attacks.

Application
when there are requirements for network communication quality time, for example: the accuracy of the entire data to be passed to the other side, which is often some of the requirements for reliable applications, such as file transfer protocol HTTP, HTTPS, FTP, etc., POP, SMTP e-mail, etc. transmission protocol.
In daily life, common applications use the TCP protocol are as follows: browser, use HTTP FlashFXP, using FTP Outlook, using POP, SMTP Putty, use Telnet, SSH QQ file transfer ......

Original: https://blog.csdn.net/Tong_jy/article/details/78477634

Guess you like

Origin www.cnblogs.com/yhongyin/p/11117709.html