TCP stream vs UDP message

后端 未结 6 811
悲哀的现实
悲哀的现实 2020-11-29 01:45

TCP is stream oriented meaning data is transferred as a continues stream of bytes. But what confuses me is that TCP creates segments and passes this down to IP. IP creates p

6条回答
  •  生来不讨喜
    2020-11-29 02:20

    The specialty about TCP is that this behaviour is transparent to the user resp. the app.

    The only thing the app has to do is call send() and recv() on order to send and get data.

    The layers below ensure that the data is received in exactly the order it was sent, and that missing data is retransmitted if it "stays missing".

    UDP, OTOH, keeps the data of one send() call together, even if it is split into several IP packets. In this way, these data can be seen as one datagram.

提交回复
热议问题