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

相关文章

MyBatis中$与#的区别解析

《MyBatis中$与#的区别解析》文章浏览阅读314次,点赞4次,收藏6次。MyBatis使用#{}作为参数占位符时,会创建预处理语句(PreparedStatement),并将参数值作为预处理语句... 目录一、介绍二、sql注入风险实例一、介绍#(井号):MyBATis使用#{}作为参数占位符时,会

Android kotlin中 Channel 和 Flow 的区别和选择使用场景分析

《Androidkotlin中Channel和Flow的区别和选择使用场景分析》Kotlin协程中,Flow是冷数据流,按需触发,适合响应式数据处理;Channel是热数据流,持续发送,支持... 目录一、基本概念界定FlowChannel二、核心特性对比数据生产触发条件生产与消费的关系背压处理机制生命周期

Javaee多线程之进程和线程之间的区别和联系(最新整理)

《Javaee多线程之进程和线程之间的区别和联系(最新整理)》进程是资源分配单位,线程是调度执行单位,共享资源更高效,创建线程五种方式:继承Thread、Runnable接口、匿名类、lambda,r... 目录进程和线程进程线程进程和线程的区别创建线程的五种写法继承Thread,重写run实现Runnab

C++中NULL与nullptr的区别小结

《C++中NULL与nullptr的区别小结》本文介绍了C++编程中NULL与nullptr的区别,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编... 目录C++98空值——NULLC++11空值——nullptr区别对比示例 C++98空值——NUL

Conda与Python venv虚拟环境的区别与使用方法详解

《Conda与Pythonvenv虚拟环境的区别与使用方法详解》随着Python社区的成长,虚拟环境的概念和技术也在不断发展,:本文主要介绍Conda与Pythonvenv虚拟环境的区别与使用... 目录前言一、Conda 与 python venv 的核心区别1. Conda 的特点2. Python v

Go语言中make和new的区别及说明

《Go语言中make和new的区别及说明》:本文主要介绍Go语言中make和new的区别及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1 概述2 new 函数2.1 功能2.2 语法2.3 初始化案例3 make 函数3.1 功能3.2 语法3.3 初始化

C# 比较两个list 之间元素差异的常用方法

《C#比较两个list之间元素差异的常用方法》:本文主要介绍C#比较两个list之间元素差异,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录1. 使用Except方法2. 使用Except的逆操作3. 使用LINQ的Join,GroupJoin

深度解析Spring Boot拦截器Interceptor与过滤器Filter的区别与实战指南

《深度解析SpringBoot拦截器Interceptor与过滤器Filter的区别与实战指南》本文深度解析SpringBoot中拦截器与过滤器的区别,涵盖执行顺序、依赖关系、异常处理等核心差异,并... 目录Spring Boot拦截器(Interceptor)与过滤器(Filter)深度解析:区别、实现

如何在Spring Boot项目中集成MQTT协议

《如何在SpringBoot项目中集成MQTT协议》本文介绍在SpringBoot中集成MQTT的步骤,包括安装Broker、添加EclipsePaho依赖、配置连接参数、实现消息发布订阅、测试接口... 目录1. 准备工作2. 引入依赖3. 配置MQTT连接4. 创建MQTT配置类5. 实现消息发布与订阅

使用Python进行GRPC和Dubbo协议的高级测试

《使用Python进行GRPC和Dubbo协议的高级测试》GRPC(GoogleRemoteProcedureCall)是一种高性能、开源的远程过程调用(RPC)框架,Dubbo是一种高性能的分布式服... 目录01 GRPC测试安装gRPC编写.proto文件实现服务02 Dubbo测试1. 安装Dubb