SMTP是基于TCP还是UDP

SMTP是基于TCP还是UDP

本文介绍了SMTP是基于TCP还是UDP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SMTP是否基于TCP或UDP?我真的无法确认.我认为SMTP应该基于UDP,但有人告诉我必须是TCP.

解决方案

从理论上讲,SMTP可以通过TCP,UDP或某些第三方协议进行处理.

根据 RFC 821 中的定义,和 RFC 5321 :

此外,互联网号码分配机构已分配端口25 用于SMTP使用的TCP和UDP.

但是,实际上,大多数(如果不是全部)组织和应用程序仅选择实现TCP协议.例如,在 Microsoft的端口列表中,端口25仅针对TCP列出,而不针对UDP. >


TCP和UDP之间的最大区别是使TCP成为理想选择,TCP进行检查以确保接收到每个数据包,如果没有收到,则重新发送它们,而UDP只会发送数据包而不检查接收情况.这使得UDP非常适合流视频之类的事情,在这种情况下,每个数据包都比保持数据包从服务器到客户端的连续流不那么重要.

考虑到SMTP,使用TCP over UDP更有意义. SMTP是一种邮件传输协议,在邮件中,每个单个数据包都很重要.如果您在邮件中间丢失了多个数据包,则收件人甚至可能没有收到该邮件,如果确实丢失了,则可能会丢失关键信息.这使TCP更合适,因为它确保了每个数据包都已传递.

Is SMTP based on TCP or UDP ? I really can't confirm it . In my opinion, SMTP should be based on UDP, but someone told me that is must be TCP.

解决方案

In theory SMTP can be handled by either TCP, UDP, or some 3rd party protocol.

As defined in RFC 821, RFC 2821, and RFC 5321:

In addition, the Internet Assigned Numbers Authority has allocated port 25 for both TCP and UDP for use by SMTP.

In practice however, most if not all organizations and applications only choose to implement the TCP protocol. For example, in Microsoft's port listing port 25 is only listed for TCP and not UDP.


The big difference between TCP and UDP that makes TCP ideal here is that TCP checks to make sure that every packet is received and re-sends them if they are not whereas UDP will simply send packets and not check for receipt. This makes UDP ideal for things like streaming video where every single packet isn't as important as keeping a continuous flow of packets from the server to the client.

Considering SMTP, it makes more sense to use TCP over UDP. SMTP is a mail transport protocol, and in mail every single packet is important. If you lose several packets in the middle of the message the recipient might not even receive the message and if they do they might be missing key information. This makes TCP more appropriate because it ensures that every packet is delivered.

这篇关于SMTP是基于TCP还是UDP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 07:16