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

相关文章

go 指针接收者和值接收者的区别小结

《go指针接收者和值接收者的区别小结》在Go语言中,值接收者和指针接收者是方法定义中的两种接收者类型,本文主要介绍了go指针接收者和值接收者的区别小结,文中通过示例代码介绍的非常详细,需要的朋友们下... 目录go 指针接收者和值接收者的区别易错点辨析go 指针接收者和值接收者的区别指针接收者和值接收者的

售价599元起! 华为路由器X1/Pro发布 配置与区别一览

《售价599元起!华为路由器X1/Pro发布配置与区别一览》华为路由器X1/Pro发布,有朋友留言问华为路由X1和X1Pro怎么选择,关于这个问题,本期图文将对这二款路由器做了期参数对比,大家看... 华为路由 X1 系列已经正式发布并开启预售,将在 4 月 25 日 10:08 正式开售,两款产品分别为华

Nginx中配置HTTP/2协议的详细指南

《Nginx中配置HTTP/2协议的详细指南》HTTP/2是HTTP协议的下一代版本,旨在提高性能、减少延迟并优化现代网络环境中的通信效率,本文将为大家介绍Nginx配置HTTP/2协议想详细步骤,需... 目录一、HTTP/2 协议概述1.HTTP/22. HTTP/2 的核心特性3. HTTP/2 的优

关于WebSocket协议状态码解析

《关于WebSocket协议状态码解析》:本文主要介绍关于WebSocket协议状态码的使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录WebSocket协议状态码解析1. 引言2. WebSocket协议状态码概述3. WebSocket协议状态码详解3

kotlin中const 和val的区别及使用场景分析

《kotlin中const和val的区别及使用场景分析》在Kotlin中,const和val都是用来声明常量的,但它们的使用场景和功能有所不同,下面给大家介绍kotlin中const和val的区别,... 目录kotlin中const 和val的区别1. val:2. const:二 代码示例1 Java

CSS Padding 和 Margin 区别全解析

《CSSPadding和Margin区别全解析》CSS中的padding和margin是两个非常基础且重要的属性,它们用于控制元素周围的空白区域,本文将详细介绍padding和... 目录css Padding 和 Margin 全解析1. Padding: 内边距2. Margin: 外边距3. Padd

Springboot @Autowired和@Resource的区别解析

《Springboot@Autowired和@Resource的区别解析》@Resource是JDK提供的注解,只是Spring在实现上提供了这个注解的功能支持,本文给大家介绍Springboot@... 目录【一】定义【1】@Autowired【2】@Resource【二】区别【1】包含的属性不同【2】@

Java中的String.valueOf()和toString()方法区别小结

《Java中的String.valueOf()和toString()方法区别小结》字符串操作是开发者日常编程任务中不可或缺的一部分,转换为字符串是一种常见需求,其中最常见的就是String.value... 目录String.valueOf()方法方法定义方法实现使用示例使用场景toString()方法方法

分辨率三兄弟LPI、DPI 和 PPI有什么区别? 搞清分辨率的那些事儿

《分辨率三兄弟LPI、DPI和PPI有什么区别?搞清分辨率的那些事儿》分辨率这个东西,真的是让人又爱又恨,为了搞清楚它,我可是翻阅了不少资料,最后发现“小7的背包”的解释最让我茅塞顿开,于是,我... 在谈到分辨率时,我们经常会遇到三个相似的缩写:PPI、DPI 和 LPI。虽然它们看起来差不多,但实际应用

GORM中Model和Table的区别及使用

《GORM中Model和Table的区别及使用》Model和Table是两种与数据库表交互的核心方法,但它们的用途和行为存在著差异,本文主要介绍了GORM中Model和Table的区别及使用,具有一... 目录1. Model 的作用与特点1.1 核心用途1.2 行为特点1.3 示例China编程代码2. Tab