gpt4 book ai didi

javascript - 使用 WebSockets 或 WebRTC 发送的数据需要 CRC 吗?

转载 作者:行者123 更新时间:2023-12-03 02:01:33 27 4
gpt4 key购买 nike

我在某处读到,当您通过普通 UDP 发送数据时,必须使用循环冗余检查来检测数据在接收时是否未损坏。

WebSockets 和 WebRTC 是否也需要这样做,或者网络浏览器可以为您做到这一点?

最佳答案

您不能将纯 UDP 与 WebRTC 结合使用:

  • WebSockets 通过 TCP 工作。调查RFC 793, page 16 ,有一个校验和。因此,它是安全的。
  • WebRTC 数据通道通过 SCTP over UDP 工作。调查RFC 4960, page 90对于 SCTP:

When sending an SCTP packet, the endpoint MUST strengthen the dataintegrity of the transmission by including the CRC32c checksum valuecalculated on the packet, as described below.

这意味着,通过 RTCDataChannel 发送的所有数据包都已经具有 CRC,并且到达目的地的所有数据包都没有损坏。因此,它也是安全的。

请记住:

  • reliable: true:检测并处理丢包(重传)
  • reliable: false:未检测到丢包。

关于javascript - 使用 WebSockets 或 WebRTC 发送的数据需要 CRC 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49996301/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com