本文介绍了如何找到我可以发送而不会分段的最大UDP数据包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我需要知道我可以发送到另一台计算机的最大UDP数据包没有碎片.

I need to know what the largest UDP packet I can send to another computer is without fragmentation.

此大小通常称为MTU(最大传输单位).假设在两台计算机之间,将有许多路由器和调制解调器,它们可能具有不同的MTU.

This size is commonly known as the MTU (Maximum Transmission Unit). Supposedly, between 2 computers, will be many routers and modems that may have different MTUs.

我了解到Windows中的TCP实现会自动在路径中找到最大MTU.

I read that the TCP implementation in windows automatically finds the maximum MTU in a path.

我也在进行实验,发现从计算机到服务器的最大MTU为57712字节+头.高于此的任何东西都将被丢弃.我的计算机在局域网上,MTU是否应该为1500字节左右?

I was also experimenting, and I found out that the maximum MTU from my computer to a server was 57712 bytes+header. Anything above that was discarded. My computer is on a LAN, isn't the MTU supposed to be around 1500 bytes?

推荐答案

以下内容无法直接回答您的问题,但您可能会发现它很有趣;它说IP数据包可以分解/重新组装,因此大于基础媒体(例如1500字节以太网)的限制:解决GRE和IPSEC的IP碎片,MTU,MSS和PMTUD问题

The following doesn't answer your question directly but you might find it interesting; it says that IP packets can be disassembled/reassembled, and therefore bigger than limit on the underling media (e.g. 1500-byte Ethernet): Resolve IP Fragmentation, MTU, MSS, and PMTUD Issues with GRE and IPSEC

有关此主题的更多信息:

More on this topic:

  • Re: UDP fragmentation says you should use ICMP instead of UDP to discover MTU
  • Path MTU Discovery says that a TCP connection might include implicit MTU negotiation via ICMP

我不知道如何通过Windows上的API生成ICMP:一次提出了这样的API,并引起了争议,因为人们认为这将使编写通过生成拒绝服务功能的软件变得容易.大量的ICMP消息.

I don't know about generating ICMP via an API on Windows: at one time such an API was proposed, and was controversial because people argued that would make it easy to write software that implements denial-of-service functionality by generating a flood of ICMP messages.

不,它似乎已实现 :例如,参见 Winsock程序员的常见问题解答示例:Ping:原始套接字方法.

No, it looks like it is implemented: see for example Winsock Programmer's FAQ Examples: Ping: Raw Sockets Method.

因此,要发现MTU,请生成带有请勿分段"标志的ping数据包.

So, to discover MTU, generate ping packets with the 'do not fragment' flag.

也许我不知道,有比这更简单的API了;但我希望我已经让您了解了基础协议.

Maybe there's an easier API than this, I don't know; but I hope I've given you to understand the underlying protocol[s].

这篇关于如何找到我可以发送而不会分段的最大UDP数据包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 15:55