gen_tcp smushed messages [duplicate]

天大地大妈咪最大 提交于 2019-11-27 15:42:47

Why they're being "smushed" at the receiving end: Because TCP is a streaming protocol, and there's no requirement for send/recv calls to have a 1-1 correspondence with network packets (even if they arrive that way over the wire).

How to "un-smush" them: Either change your TCP protocol to include a message delimiter, so you can extract messages from the stream without needing to know where the packet boundaries were; or use UDP instead of TCP.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!