Is TCP Guaranteed to arrive in order?

前端 未结 4 1306
醉梦人生
醉梦人生 2021-02-01 14:24

If I send two TCP messages, do I need to handle the case where the latter arrives before the former? Or is it guaranteed to arrive in the order I send it? I assume that this is

4条回答
  •  一整个雨季
    2021-02-01 15:14

    TCP is a stream, UDP is a message. You're mixing up terms. For TCP it is true that the stream will arrive in the same order as it was send. There are no distict messages in TCP, bytes appear as they arrive, interpreting them as messages is up to you.

提交回复
热议问题