为什么即使在本地运行进程,也会无序地获取UDP数据报? [英] Why do I get UDP datagrams out of order even with processes running locally?

查看:221
本文介绍了为什么即使在本地运行进程,也会无序地获取UDP数据报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发流媒体服务器和Flash客户端之间的java接口。我注意到即使两个进程都在本地运行,UDP数据报也可能无法到达我的界面。

I'm developing a java interface between a streaming server and a flash client. I noticed that UDP datagrams can reach my interface out of order even if both processes are running locally.

这是正常的吗?我认为,因为没有数据报必须经过任何路由器或任何网络设备,所以不应该发生这种情况。

Is that normal? I thought that as no datagram has to go through any router or any network device, then that should not be happening.

推荐答案

实际上即使它们是由localhost在localhost上发送的,也无法保证UDP数据包的排序和接收。只是因为协议的规范并没有暗示它的任何内容。

Actually there are no guarantees of ordering and reception about UDP packets, even if they are sent by localhost on localhost. Just because the specification of the protocol doesn't imply anything about it.

由于你不能对它们做出假设,你应该选择使用TCP或通过使用来处理重新排序程序处理的序列号..

Since you can't make assumptions on them you should choose to use TCP or handle reordering by using a sequence number handled by your programs..

这篇关于为什么即使在本地运行进程,也会无序地获取UDP数据报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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