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

标签 javascript websocket network-programming webrtc crc

我在某处读到,当您通过普通 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 data integrity of the transmission by including the CRC32c checksum value calculated on the packet, as described below.

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

请记住:

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

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

相关文章:

html - websockets 可以用来创建客户端到客户端的连接吗?

algorithm - 完整加权网络中的社区检测

java - 如何使用java持续向端口(TCP)发送数据?

php - 将动态 javascript 变量添加到脚本

javascript - 如何测试expressJS Controller -NodeJS

javascript - Mocha中获取父语句的描述

c - 为什么recvfrom关心数据来自谁

javascript - 如何在 NVD3 图表中使用自定义图例

node.js - 如何为房间中的所有客户端更新套接字对象? (socket.io)

node.js - 如何将 Node.js WebSocket 服务器部署到 Amazon Elastic Beanstalk?