什么是信息的边界? [英] What is a message boundary?

查看:1864
本文介绍了什么是信息的边界?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是的的消息bonudaries在以下方面?

TCP和UDP之间的一个区别是该UDP保存消息
边界。

One difference between TCP and UDP is that UDP preserves message boundaries.

我明白之间​​的差别的 TCP UDP ,但不确定的消息边界的定义。由于UDP包括每个数据包的目标和端口信息,也可能是这足以给消息的边界

I understand the difference between TCP and UDP, but unsure about the definition of "message boundaries". Since UDP includes the destination and port information in each individual packet, could it be this that gives message a "boundary"?

推荐答案

没有,消息边界无关与目的地或端口。 A的消息边界,是通过协议发送两条消息之间的间隔。 UDP保存消息界限。如果通过UDP发送FOO,然后选择BAR,另一端会收到两个数据包,一个包含FOO另含BAR。

No, message boundaries have nothing to do with destinations or ports. A "message boundary" is the separation between two messages being sent over a protocol. UDP preserves message boundaries. If you send "FOO" and then "BAR" over UDP, the other end will receive two datagrams, one containing "FOO" and the other containing "BAR".

如果你发送FOO,然后选择BAR通过TCP,没有消息边界被保留。另一端可能会得到FOO,然后选择BAR。或者,它可能会FOOBAR。或者,它可能会得到F,然后OOB,然后AR。 TCP不作任何尝试保留应用程序消息的边界 - 它只是一个在每个方向上的字节流

If you send "FOO" and then "BAR" over TCP, no message boundary is preserved. The other end might get "FOO" and then "BAR". Or it might get "FOOBAR". Or it might get "F" and then "OOB" and then "AR". TCP does not make any attempt to preserve application message boundaries -- it's just a stream of bytes in each direction.

这篇关于什么是信息的边界?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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