tcp和udp协议的相似_比较TCP与UDP协议,区别和相似之处

2024-01-04 10:59

本文主要是介绍tcp和udp协议的相似_比较TCP与UDP协议,区别和相似之处,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

tcp和udp协议的相似

tcp和udp协议的相似

Networks are used to transmit data over the world. There is a lot of network protocols in use. But most known and used protocols are IP, TCP, UDP. IP lives different flat but TCP and UDP try to live the same flat. So they operate the same network layer but what is different between UDP and TCP. Why should I use TCP or not use? The same questions can be asked for UDP too. In this post, we will look at what is the same and different for these protocols. TCP stands for Transmission Control Protocol. UDP stands for User Datagram Protocol

网络用于在世界范围内传输数据。 有许多网络协议正在使用中。 但是,最知名和使用的协议是IP,TCP,UDP。 IP生活在不同的公寓中,但TCP和UDP尝试居住在同一公寓中。 因此,它们使用相同的网络层,但是UDP和TCP之间的区别是什么。 为什么要使用TCP或不使用TCP? 对于UDP也可以询问相同的问题。 在本文中,我们将探讨这些协议的相同点和不同点。 TCP代表传输控制协议。 UDP代表用户数据报协议

OSI网络层(OSI Network Layer)

They both live the same Layer according to the OSI Reference Model. We call this layer as Transmission Layer. In this layer between sockets, data is transmitted. They have no difference in this side.

根据OSI参考模型,它们都位于同一层。 我们将此层称为传输层。 在套接字之间的这一层中,传输数据。 他们在这方面没有区别。

封包结构 (Packet Structure)

UDP
UDP
UDP协议

UDP has a lean package structure. UDP provides just Source, Destination Port, Length, Checksum in its header part.

UDP具有精益包结构。 UDP在其标头部分仅提供源,目标端口,长度,校验和。

TCP
TCP
TCP协议

TCP has more fields in the package because TCP transmission has more steps and controls for package delivery. TCP has 12 header fields.

TCP在程序包中包含更多字段,因为TCP传输具有更多程序包传递步骤和控件。 TCP具有12个标头字段。

复杂 (Complexity)

TCP is absolutely more complex than UDP protocol. As we see in the upper side TCP have a lot of area for transmission-related mechanisms. For example, TCP provides the mechanism of a window which sets transmission buffer related memory. UDP has just checksum mechanism and packet counter which is sometimes not implemented.

TCP绝对比UDP协议复杂。 正如我们在上侧所看到的,TCP具有许多与传输相关的机制。 例如,TCP提供了设置传输缓冲区相关内存的窗口机制。 UDP只是具有校验和机制和数据包计数器,有时无法实现。

算法 (Algorithm)

To transmit data with TCP a session must be created with a method named 3-way handshake. The first client sends a packet with the SYN flag is set and the server responds with ACK flags and the last step the client sends SYNC+ACK to accomplish a TCP session with the related server. UDP does not have any special algorithm. UDP packages are directly sent to the server’s port. Management did generally in the upper application layer.

要使用TCP传输数据,必须使用名为3向握手的方法创建会话。 第一个客户端发送设置了SYN标志的数据包,服务器使用ACK标志进行响应,最后一步,客户端发送SYNC + ACK以完成与相关服务器的TCP会话。 UDP没有任何特殊算法。 UDP包直接发送到服务器的端口。 管理通常在上层应用程序层进行。

LEARN MORE  Linux fuser Command Tutorial With Examples
了解更多Linux融合器命令教程和示例

速度(Speed)

The complexity of TCP protocol makes TCP slower than UDP. At least to send just a single byte there needs to be a session initialization and after data transfer closes the session. This makes TCP slower. There is some work done about the speed of  TCP but the architecture is limited new enhancements. UDP is lightfast if you transmit it over fiber optic;).UDP is fast because there are no algorithms for session or session termination.

TCP协议的复杂性使TCP比UDP慢。 至少要仅发送一个字节,就需要进行会话初始化,并且在数据传输关闭会话之后。 这会使TCP变慢。 关于TCP的速度已经完成了一些工作,但是该体系结构在新的增强功能方面受到限制。 如果通过光纤传输UDP,则UDP很快;)。UDP很快,因为没有用于会话或会话终止的算法。

可靠性 (Reliability)

TCP is a reliable protocol because it runs mechanisms to prevent data loss or change. TCP uses sessions to make data transmission reliability. Also in the data transfer, transmitted data is checked by between sides, and if some loss or change occurred data is re-transmitted again. UDP is nor reliable. Really it is not. But if you want it to be reliable upper layer application-level mechanisms can be implemented but these will make the transmission more complex.

TCP是一种可靠的协议,因为它运行防止数据丢失或更改的机制。 TCP使用会话来确保数据传输的可靠性。 同样在数据传输中,通过双方之间检查发送的数据,并且如果发生某些丢失或更改,则再次重新发送数据。 UDP也不可靠。 真的不是。 但是,如果您希望它可靠,则可以实施上层应用程序级机制,但这会使传输更加复杂。

安全 (Security)

From the security point of view, both TCP and UDP are the same. Actually, TCP has some little advantages because of its session management but for a general look, there are both secure if security mechanisms like SSL, Encryption is implemented. Implementing SSL/TLS like protocols for TCP is very easy besides UDP. On the other side, voice communication protocols like RTP can be upgraded to the SRTP to make underlying UDP more secure.

从安全角度来看,TCP和UDP都是相同的。 实际上,由于会话管理,TCP几乎没有什么优势,但是从总体上看,如果实现了SSL,加密等安全机制,则两者都是安全的。 除了UDP之外,为TCP实现类似SSL / TLS的协议也非常容易。 另一方面,可以将语音通信协议(如RTP)升级到SRTP,以使基础UDP更安全。

规约 (Protocols)

In this part, we will list protocols using UDP or TCP or both.

在这一部分中,我们将列出使用UDP或TCP或两者的协议。

UDP协议 (UDP)

The following protocols are using UDP transmission.

以下协议正在使用UDP传输。

  • DHCP

    DHCP服务器
  • DNS

    域名解析
  • Streaming

    流媒体
  • RDP

    RDP
  • TFTP

    TFTP
  • SNMP

    SNMP协议
  • VOIP

    网络电话
LEARN MORE  How To Get Mac Address In Windows?
了解更多如何在Windows中获取Mac地址?

TCP协议 (TCP)

The following protocols are using TCP transmission.

以下协议正在使用TCP传输。

  • HTTP

    HTTP
  • HTTPS

    HTTPS
  • FTP

    的FTP
  • SMTP

    SMTP
  • TELNET

    电信网

翻译自: https://www.poftut.com/compare-tcp-vs-udp-protocols-differences-and-similarities/

tcp和udp协议的相似

这篇关于tcp和udp协议的相似_比较TCP与UDP协议,区别和相似之处的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/569116

相关文章

在Dockerfile中copy和add的区别及说明

《在Dockerfile中copy和add的区别及说明》COPY和ADD都是Dockerfile中用于文件复制的命令,但COPY仅用于本地文件或目录的复制,不支持自动解压缩;而ADD除了复制本地文件或... 目录在dockerfile中,copy 和 add有什么区别?COPY 命令ADD 命令总结在Doc

解读Pandas和Polars的区别及说明

《解读Pandas和Polars的区别及说明》Pandas和Polars是Python中用于数据处理的两个库,Pandas适用于中小规模数据的快速原型开发和复杂数据操作,而Polars则专注于高效数据... 目录Pandas vs Polars 对比表使用场景对比Pandas 的使用场景Polars 的使用

Qt 中集成mqtt协议的使用方法

《Qt中集成mqtt协议的使用方法》文章介绍了如何在工程中引入qmqtt库,并通过声明一个单例类来暴露订阅到的主题数据,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录一,引入qmqtt 库二,使用一,引入qmqtt 库我是将整个头文件/源文件都添加到了工程中进行编译,这样 跨平台

Java中ArrayList和LinkedList有什么区别举例详解

《Java中ArrayList和LinkedList有什么区别举例详解》:本文主要介绍Java中ArrayList和LinkedList区别的相关资料,包括数据结构特性、核心操作性能、内存与GC影... 目录一、底层数据结构二、核心操作性能对比三、内存与 GC 影响四、扩容机制五、线程安全与并发方案六、工程

Python如何计算两个不同类型列表的相似度

《Python如何计算两个不同类型列表的相似度》在编程中,经常需要比较两个列表的相似度,尤其是当这两个列表包含不同类型的元素时,下面小编就来讲讲如何使用Python计算两个不同类型列表的相似度吧... 目录摘要引言数字类型相似度欧几里得距离曼哈顿距离字符串类型相似度Levenshtein距离Jaccard相

C#比较两个List集合内容是否相同的几种方法

《C#比较两个List集合内容是否相同的几种方法》本文详细介绍了在C#中比较两个List集合内容是否相同的方法,包括非自定义类和自定义类的元素比较,对于非自定义类,可以使用SequenceEqual、... 目录 一、非自定义类的元素比较1. 使用 SequenceEqual 方法(顺序和内容都相等)2.

java中不同版本JSONObject区别小结

《java中不同版本JSONObject区别小结》本文主要介绍了java中不同版本JSONObject区别小结,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们... 目录1. FastjsON2. Jackson3. Gson4. org.json6. 总结在Jav

数据库使用之union、union all、各种join的用法区别解析

《数据库使用之union、unionall、各种join的用法区别解析》:本文主要介绍SQL中的Union和UnionAll的区别,包括去重与否以及使用时的注意事项,还详细解释了Join关键字,... 目录一、Union 和Union All1、区别:2、注意点:3、具体举例二、Join关键字的区别&php

java中的HashSet与 == 和 equals的区别示例解析

《java中的HashSet与==和equals的区别示例解析》HashSet是Java中基于哈希表实现的集合类,特点包括:元素唯一、无序和可包含null,本文给大家介绍java中的HashSe... 目录什么是HashSetHashSet 的主要特点是HashSet 的常用方法hasSet存储为啥是无序的

对postgresql日期和时间的比较

《对postgresql日期和时间的比较》文章介绍了在数据库中处理日期和时间类型时的一些注意事项,包括如何将字符串转换为日期或时间类型,以及在比较时自动转换的情况,作者建议在使用数据库时,根据具体情况... 目录PostgreSQL日期和时间比较DB里保存到时分秒,需要和年月日比较db里存储date或者ti