📅  最后修改于: 2020-11-10 04:43:38             🧑  作者: Mango
TCP代表传输控制协议。如果我们希望两台计算机之间的通讯和通讯应该良好而可靠。例如,我们要查看网页,然后希望页面上什么都没有丢失,或者我们要下载文件,然后我们需要完整的文件,即什么都不应该丢失,它可以是文本或图像。由于TCP,这只能是可能的。它是TCP / IP网络上使用最广泛的协议之一。
以下是TCP的功能:
UDP代表用户数据报协议。它的工作方式类似于TCP,因为它也用于发送和接收消息。主要区别在于UDP是无连接协议。在这里,无连接意味着在通信之前没有建立连接。它也不保证数据包的传送。甚至不关心数据是否已在接收器端接收,因此也称为“即发即弃”协议。它也被称为“发射后遗忘”协议,因为它发送数据并且不关心是否接收到数据。 UDP比TCP更快,因为它不能保证包的传递。
让我们以表格形式查看TCP和UDP之间的区别。
TCP | UDP | |
---|---|---|
Full form | It stands for Transmission Control Protocol. | It stands for User Datagram Protocol. |
Type of connection | It is a connection-oriented protocol, which means that the connection needs to be established before the data is transmitted over the network. | It is a connectionless protocol, which means that it sends the data without checking whether the system is ready to receive or not. |
Reliable | TCP is a reliable protocol as it provides assurance for the delivery of data packets. | UDP is an unreliable protocol as it does not take the guarantee for the delivery of packets. |
Speed | TCP is slower than UDP as it performs error checking, flow control, and provides assurance for the delivery of | UDP is faster than TCP as it does not guarantee the delivery of data packets. |
Header size | The size of TCP is 20 bytes. | The size of the UDP is 8 bytes. |
Acknowledgment | TCP uses the three-way-handshake concept. In this concept, if the sender receives the ACK, then the sender will send the data. TCP also has the ability to resend the lost data. | UDP does not wait for any acknowledgment; it just sends the data. |
Flow control mechanism | It follows the flow control mechanism in which too many packets cannot be sent to the receiver at the same time. | This protocol follows no such mechanism. |
Error checking | TCP performs error checking by using a checksum. When the data is corrected, then the data is retransmitted to the receiver. | It does not perform any error checking, and also does not resend the lost data packets. |
Applications | This protocol is mainly used where a secure and reliable communication process is required, like military services, web browsing, and e-mail. | This protocol is used where fast communication is required and does not care about the reliability like VoIP, game streaming, video and music streaming, etc. |