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

相关文章

百度/小米/滴滴/京东,中台架构比较

小米中台建设实践 01 小米的三大中台建设:业务+数据+技术 业务中台--从业务说起 在中台建设中,需要规范化的服务接口、一致整合化的数据、容器化的技术组件以及弹性的基础设施。并结合业务情况,判定是否真的需要中台。 小米参考了业界优秀的案例包括移动中台、数据中台、业务中台、技术中台等,再结合其业务发展历程及业务现状,整理了中台架构的核心方法论,一是企业如何共享服务,二是如何为业务提供便利。

native和static native区别

本文基于Hello JNI  如有疑惑,请看之前几篇文章。 native 与 static native java中 public native String helloJni();public native static String helloJniStatic();1212 JNI中 JNIEXPORT jstring JNICALL Java_com_test_g

【Linux】应用层http协议

一、HTTP协议 1.1 简要介绍一下HTTP        我们在网络的应用层中可以自己定义协议,但是,已经有大佬定义了一些现成的,非常好用的应用层协议,供我们直接使用,HTTP(超文本传输协议)就是其中之一。        在互联网世界中,HTTP(超文本传输协议)是一个至关重要的协议,他定义了客户端(如浏览器)与服务器之间如何进行通信,以交换或者传输超文本(比如HTML文档)。

Android fill_parent、match_parent、wrap_content三者的作用及区别

这三个属性都是用来适应视图的水平或者垂直大小,以视图的内容或尺寸为基础的布局,比精确的指定视图的范围更加方便。 1、fill_parent 设置一个视图的布局为fill_parent将强制性的使视图扩展至它父元素的大小 2、match_parent 和fill_parent一样,从字面上的意思match_parent更贴切一些,于是从2.2开始,两个属性都可以使用,但2.3版本以后的建议使

Collection List Set Map的区别和联系

Collection List Set Map的区别和联系 这些都代表了Java中的集合,这里主要从其元素是否有序,是否可重复来进行区别记忆,以便恰当地使用,当然还存在同步方面的差异,见上一篇相关文章。 有序否 允许元素重复否 Collection 否 是 List 是 是 Set AbstractSet 否

javascript中break与continue的区别

在javascript中,break是结束整个循环,break下面的语句不再执行了 for(let i=1;i<=5;i++){if(i===3){break}document.write(i) } 上面的代码中,当i=1时,执行打印输出语句,当i=2时,执行打印输出语句,当i=3时,遇到break了,整个循环就结束了。 执行结果是12 continue语句是停止当前循环,返回从头开始。

maven发布项目到私服-snapshot快照库和release发布库的区别和作用及maven常用命令

maven发布项目到私服-snapshot快照库和release发布库的区别和作用及maven常用命令 在日常的工作中由于各种原因,会出现这样一种情况,某些项目并没有打包至mvnrepository。如果采用原始直接打包放到lib目录的方式进行处理,便对项目的管理带来一些不必要的麻烦。例如版本升级后需要重新打包并,替换原有jar包等等一些额外的工作量和麻烦。为了避免这些不必要的麻烦,通常我们

ActiveMQ—Queue与Topic区别

Queue与Topic区别 转自:http://blog.csdn.net/qq_21033663/article/details/52458305 队列(Queue)和主题(Topic)是JMS支持的两种消息传递模型:         1、点对点(point-to-point,简称PTP)Queue消息传递模型:         通过该消息传递模型,一个应用程序(即消息生产者)可以

【Go】go连接clickhouse使用TCP协议

离开你是傻是对是错 是看破是软弱 这结果是爱是恨或者是什么 如果是种解脱 怎么会还有眷恋在我心窝 那么爱你为什么                      🎵 黄品源/莫文蔚《那么爱你为什么》 package mainimport ("context""fmt""log""time""github.com/ClickHouse/clickhouse-go/v2")func main(

关键字synchronized、volatile的比较

关键字volatile是线程同步的轻量级实现,所以volatile性能肯定比synchronized要好,并且volatile只能修饰于变量,而synchronized可以修饰方法,以及代码块。随着JDK新版本的发布,synchronized关键字的执行效率上得到很大提升,在开发中使用synchronized关键字的比率还是比较大的。多线程访问volatile不会发生阻塞,而synchronize