Sending Messages in a TCP Stream

前端 未结 5 1349
予麋鹿
予麋鹿 2021-01-19 07:36

TCP is stream-based, which means you send bytes without them necessarily being in a \"message\", so the receiver may get half a message or one and two thirds of messages.

5条回答
  •  没有蜡笔的小新
    2021-01-19 08:17

    If you are looking transport layer protocol, then check SCTP. SCTP is message-oriented like UDP and ensures reliable, in-sequence transport of messages with congestion control like TCP.

    SCTP is not yet widely used. So I suggest to use TCP with some kind of message framing.

提交回复
热议问题