数据包丢失的几率有多大

数据包丢失的几率有多大

本文介绍了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?

我的第一个想法是,也许这仅仅是因为我的导师在我们的案例中认为,客户端和服务器都将在同一台机器上运行,并且文件将从一个进程传输到另一个进程,甚至超过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 是否会丢失数据包、损坏数据包或乱序传送实际网络.

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.

我还想知道实际上丢失数据包、损坏数据包或使它们在现实中无序交付的可能性通常是在两个地理上相距遥远的主机之间通过互联网进行的.

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.

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

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

推荐答案

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

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.

这让我怀疑,如果服务器和客户端是同一台机器上的两个进程,并且不必通过其他进程出去,UDP 是否会丢失数据包、损坏数据包或乱序传送实际网络.

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

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.

我还想知道实际上丢失数据包、损坏数据包或使它们在现实中无序交付的可能性通常是在两个地理上相距遥远的主机之间通过互联网进行的.

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

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%.

您可能对 互联网流量报告 以及诸如 这个.

You may be interested in The Internet Traffic Report and possibly pages such as this.

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

07-25 21:56