The advantage of TCP

The reliability and stability of TCP are shown in that TCP establishes a connection with three handshakes before data transfer. During data transfer, TCP provides confirmation, window, retransmission, and congestion control mechanisms. After data transfer, TCP disconnects to save system resources. Disadvantages of TCP: TCP is slow, inefficient, occupies high system resources, and is vulnerable to attacks. Before transmitting data, TCP establishes a connection, which consumes time. In addition, during data transmission, confirmation mechanisms, retransmission mechanisms, congestion control mechanisms, etc., all consume a lot of time. Each connection consumes hardware resources such as CPU and memory. In addition, TCP has the confirmation mechanism and three-way handshake mechanism, which makes IT easy to be exploited to implement DOS, DDOS, and CC attacks.

The advantages of UDP

UDP does not have TCP’s mechanisms for handshake, acknowledgement, windowing, retransmission, congestion control, etc. UDP is a stateless transport protocol, so it is very fast when transferring data. Without these mechanisms, UDP is less vulnerable to attack than TCP. However, UDP attacks cannot be avoided, for example, UDP Flood attacks…… Disadvantages of UDP: Unreliable and unstable Because UDP does not have the reliable mechanism of TCP, it is easy to lose packets during data transfer if the network quality is poor. Based on the advantages and disadvantages of the above, when should TCP be used? When network communication quality is required, for example, the entire data must be accurately transmitted to the other party. This is usually used for reliable applications, such as HTTP, HTTPS, FTP, and POP and SMTP. In daily life, TCP protocol is commonly used in the following applications: browser, HTTP FlashFXP, FTP Outlook, POP, SMTP Putty, Telnet, SSH QQ file transfer ………… When to use UDP: When the network communication quality is not high and the network communication speed is required, UDP can be used. For example, common UDP applications are as follows: QQ Voice QQ Video TFTP……

UPD is used in some application scenarios that do not have high reliability requirements, such as long video and speed requirements

Differences between TCP and UDP:

  • 1. Connection-based and connectionless;

  • 2. Requirements on system resources (more TCP and less UDP);

  • 3.UDP program structure is simple;

  • 4. Stream mode and datagram mode;

  • 5.TCP ensures data correctness, UDP may lose packets, TCP ensures data sequence, UDP does not.

The difference between TCP and UDP

TCP UDP

Connection-oriented Or not Connection-oriented Or not

Transmission reliability Reliability

Application Scenarios Transfer large amounts of data small amounts of data

Slow speed is fast

Differences between TCP and UDP:

  • 1, TCP connection-oriented (for example, to make a phone call to establish a connection); UDP is connectionless, that is, no connection is required before sending data

  • 2. TCP provides reliable service. That is to say, data transmitted through the TCP connection is error-free, not lost, not repeated, and in order to arrive; UDP does its best to deliver, i.e. reliable delivery is not guaranteed

  • 3. TCP byte stream oriented, in fact TCP treats data as a series of unstructured byte streams; UDP is packet oriented

  • UDP does not have congestion control, so network congestion does not slow down the sending rate of the source host (useful for real-time applications such as IP telephony and real-time video conferencing).

  • 4. Each TCP connection can be point-to-point only. UDP supports one-to-one, one-to-many, many-to-one and many-to-many interactive communication

  • 5. TCP header cost 20 bytes; The header of UDP has a small overhead of only 8 bytes

  • 6. The logical communication channel of TCP is a full-duplex reliable channel, while UDP is an unreliable channel

Dry goods share

  • If __name__ == ‘__main__’

  • Python: three ways to implement recursive traversal of files

  • Onlookers: Gao concurrency those things

  • Operations development: Git commit specifications you might have missed

  • Explore the 500W mystery: Python to capture and analyze the last 10 years of winning lottery results

  • Basic Linux Operations essentials: Xargs is here from the beginning to the magic level

  • This is how Tomcat project deployment works

  • How does a small team build an automated operation and maintenance system from scratch?

  • How to use the ls command? Would you really?

  • O&m must see: Nginx service configuration full resolution

  • Python System Learning Flowchart: A step-by-step guide to learning the Python language

  • Linux O&M skills: Hard disk partitioning in command line mode

  • Linux network detection and security audit tool NMAP application practice

  • A friendly alternative to Find in Linux

  • Yum yum yum yum yum yum yum

  • The love-hate dispute between Linux processes and threads……

  • Cobbler Automated Installation and Deployment: a quick start guide

  • How do I load/uninstall a Linux kernel module

  • Redis persists those things

  • Here are 20 handy Unix/Linux command tips for you

  • The Pythoy with… The context of the AS statement

  • How to clone, modify, add, and delete files in Git?

  • It turns out that operations is more than Linux, and there is so much to know?

  • Python network crawler is used to capture the province and city distribution of wechat friends and its visualization

  • Build MySQL master-slave replication based on Docker

  • Technical challenges and practice summary behind 100 billion visits of wechat circle of Friends

  • Python MySQL and SQLAlchemy operations summary

  • Operation and maintenance must be basic: do you know how to play touch

  • Operation and maintenance must be basic: AWK from entry to god

  • What does functools do in Python?

  • O&m attention: Redis vulnerability utilization and defense

  • O&m development answer: What happens from entering the URL to displaying the page

  • Python minimum coding specification

  • Shell Scripting: Gameplay you don’t know

  • Seven of the best Open Source Web servers available for the enterprise

  • Do you know how to check Linux distribution names and version numbers?

  • Common MySQL high availability solution selection interpretation