What is a message boundary?

前端 未结 2 747
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 05:31

What is \"message bonudaries\" in the following context?

One difference between TCP and UDP is that UDP preserves message boundarie

相关标签:
2条回答
  • 2020-12-01 06:06

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

    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.

    0 讨论(0)
  • 2020-12-01 06:20

    Message boundaries in this context is simply the start & end of the message/packet. With TCP connections, all messages/packets are combined into a continuous stream of data, whereas with UDP the messages are given to you in their original form. They will have an exact size in bytes.

    0 讨论(0)
提交回复
热议问题