如何使用 Web RTC - Javascript 发送 UDP 数据包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13216785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 18:06:11  来源:igfitidea点击:

How to send a UDP Packet with Web RTC - Javascript?

javascriptudpwebrtc

提问by Taurian

How do you send a UDP Packet using Web RTC?

如何使用 Web RTC 发送 UDP 数据包?

采纳答案by gogasca

You should check sipml5, http://code.google.com/p/sipml5/get the code and look into the folder: sipml5/src/tinySIP/src/transports

您应该检查 sipml5,http://code.google.com/p/sipml5/获取代码并查看文件夹:sipml5/src/tinySIP/src/transsports

回答by Martin Thomson

You can't send a UDP packet directly with WebRTC. That would violate the basic security constraints required by the browser.

您不能直接使用 WebRTC 发送 UDP 数据包。这将违反浏览器所需的基本安全约束。

You can send SRTPto an ICE-enabledhost. That is probably not what you are looking for.

您可以将SRTP发送到支持ICE 的主机。这可能不是你要找的。

If a browser permitted sending arbitrary UDP packets, then malicious applications could send packets to any host.

如果浏览器允许发送任意 UDP 数据包,则恶意应用程序可以将数据包发送到任何主机。

This might not sound so bad, after all, hosts on the Internet need to be able to deal with that right? The problem is that some browsers are in protected environments where access to the network is restricted. Within those networks, some hosts are far less protected than a host on the public Internet might be. This would be OK, since access to the network is controlled.

这听起来可能没那么糟糕,毕竟互联网上的主机需要能够处理吗?问题是某些浏览器处于受保护的环境中,对网络的访问受到限制。在这些网络中,某些主机受到的保护远不如公共 Internet 上的主机受到的保护。这没问题,因为对网络的访问是受控制的。

If it were possible for a browser to send arbitrary packets, a user on a browser in that environment could be convinced to send specifically crafted packets to one of these poorly protected hosts. Likely, that would result in the network operator banning the browser, which is something browser-makers want very much to avoid.

如果浏览器可以发送任意数据包,则可以说服该环境中浏览器上的用户将特制的数据包发送到这些保护不佳的主机之一。这可能会导致网络运营商禁止浏览器,这是浏览器制造商非常希望避免的。

WebRTC only sends certain types of UDP packet under specific conditions. If the host that you are interested in talking to understands ICEand is able to consume RTPwith SRTPor SCTP over DTLS(unlikely methinks). Then perhaps you could force the browser to send something.

WebRTC 仅在特定条件下发送某些类型的 UDP 数据包。如果您有兴趣与之交谈的主机了解ICE并且能够通过 DTLS使用带有SRTPSCTP 的RTP(我认为不太可能)。那么也许你可以强制浏览器发送一些东西。