丢失 UDP 数据包的可能性有多大? [英] What are the chances of losing a UDP packet?

查看:18
本文介绍了丢失 UDP 数据包的可能性有多大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我正在为我的网络课程编程,我必须使用 UDP 在 Java 中实现一个项目.我们正在实现一个 HTTP 服务器和客户端以及一个以指定概率破坏数据包的gremlin"函数.HTTP 服务器必须在应用层将一个大文件分成多个段,然后通过 UDP 发送给客户端.客户端必须在应用层重新组装接收到的段.然而,我想知道的是,如果 UDP 根据定义是不可靠的,为什么我必须在这里模拟不可靠性?

Okay, so I am programming for my networking course and I have to implement a project in Java using UDP. We are implementing an HTTP server and client along with a 'gremlin' function that corrupts packets with a specified probability. The HTTP server has to break a large file up into multiple segments at the application layer to be sent to the client over UDP. The client must reassemble the received segments at the application layer. What I am wondering however is, if UDP is by definition unreliable, why am I having to simulate unreliability here?

我的第一个想法是,也许这仅仅是因为我的导师在我们的案例中计算,客户端和服务器都将在同一台机器上运行,并且文件将 100% 可靠地从一个进程传输到另一个进程,甚至超过UDP,因为它位于同一台计算机上的两个进程之间.

My first thought is that perhaps it's simply because my instructor is figuring in our case, both the client and the server will be run on the same machine and that the file will be transferred from one process to another 100% reliably even over UDP since it is between two processes on the same computer.

这让我首先质疑,如果服务器和客户端被保证是同一台物理机器上的两个进程,那么 UDP 是否真的会丢失数据包、损坏数据包或乱序传递数据包,保证仅通过 localhost 严格路由,使其永远不会通过网络发送出去.

This led me first to question whether or not UDP could ever actually lose a packet, corrupt a packet, or deliver a packet out of order if the server and client were guaranteed to be two processes on the same physical machine, guaranteed to be routed strictly over localhost only such that it won't ever go out over the network.

我还想知道,一般来说,对于给定的数据包,UDP 在用于促进​​两个主机之间通过开放互联网进行通信时丢弃/损坏/或乱序传送数据包的大致概率是多少?彼此在地理上相距甚远(例如,类似于美国普通宽带用户与 Google 的 CDN 之一之间的路线)?我主要是想大致了解通过 UDP 通信时所经历的情况,它是否会丢弃/损坏/错误排序大约 25% 的数据包,或者更像是大约 0.001% 的数据包包?

I would also like to know, in general, for a given packet what is the rough probability that UDP will drop / corrupt / or deliver a packet out of order while being used to facilitate communication over the open internet between two hosts that are fairly geographically distant from one another (say something comparable to the route between the average broadband user in the US to one of Google's CDNs)? I'm mostly just trying to get a general idea of the conditions experienced when communicated over UDP, does it drop / corrupt / misorder something on the order of 25% of packets, or is it more like something on the order of 0.001% of packets?

非常感谢任何可以为我解答这些问题的人.

Much appreciation to anyone who can shed some light on any of these questions for me.

推荐答案

如果 UDP 根据定义是不可靠的,为什么我必须在这里模拟不可靠?

if UDP is by definition unreliable, why am I having to simulate unreliability here?

拥有一个受控机制来模拟最坏的情况以及您的客户端和服务器如何响应它们是非常有用的.讲师可能会希望您展示该系统的稳健性.

It is very useful to have a controlled mechanism to simulate worst case scenarios and how both your client and server can respond to them. The instructor will likely want you to demonstrate how robust the system can be.

您在这里还谈论有效负载有效性,而不仅仅是丢包.

You are also talking about payload validity here and not just packet loss.

如果服务器和客户端是同一台机器上的两个进程并且不必通过实际网络.

This led me to question whether or not UDP, lose a packet, corrupt a packet, or deliver it out of order if the server and client were two processes on the same machine and it wasn't having to go out over the actual network.

环回适配器显然不太可能,但这并非不可能.

It is obviously less likely over the loopback adapter, but this is not impossible.

我发现了一些关于该主题的论坛帖子 这里这里.

I found a few forum posts on the topic here and here.

我还想知道实际上丢失数据包、损坏数据包或让数据包在现实中乱序传送的可能性通常是通过互联网在两个地理位置相距遥远的主机之间发生的.

I am also wondering what the chances of actually losing a packet, having it corrupted, or having them delivered out of order in reality would usually be over the internet between two geographically distant hosts.

这个问题可能需要缩小一点.应用级别(数据包大小和频率)以及沿路径的路由器和交换机的限制/流量有几个因素.

This question would probably need to be narrowed down a bit. There are several factors both application level (packet size and frequency) as well as limitations/traffic of routers and switches along the path.

我在这方面找不到任何确切的数字,但它似乎相当低……比如低于 5%.

I couldn't find any hard numbers on this but it seems to be fairly low... like sub 5%.

您可能对Internet 流量报告 以及这个.

这篇关于丢失 UDP 数据包的可能性有多大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆