Html 在浏览器中从 udp 端口读取
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17605252/
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
Reading from udp port in browser
提问by C graphics
Aside from Java Applet, is there anyway we can read from an UDP socket? I know websockets are TCP sockets, but I need to communicate with a server via udp sockets, anything in HTML5, or anything at all? I have looked at this post from:two years agoand this one as well again from two years ago no UDP. I was wondering if there is any new way now that we are in 2013 to use the browser to communicate with a server via udp socket?
除了 Java Applet 之外,我们还有什么可以从 UDP 套接字读取数据的吗?我知道 websockets 是 TCP 套接字,但我需要通过 udp 套接字、HTML5 中的任何内容或任何内容与服务器通信?我已经看过此帖来自:两年前,这是一个很好再次从 两年前没有UDP。我想知道现在我们在 2013 年是否有任何新方法可以使用浏览器通过 udp 套接字与服务器通信?
采纳答案by Jeremy Harris
What you are looking for can't be done with in Javascript due to security constraints such as Distributed Denial of Service (DDOS) attacks. The closest technology available (that I know of) for client-side JS is WebRTC.
由于分布式拒绝服务 (DDOS) 攻击等安全限制,您在 Javascript 中无法完成您正在寻找的内容。可用于客户端 JS 的最接近的技术(据我所知)是WebRTC。
With WebRTC you can use DataChannels over SRTPand ICE as a possible solution.
使用 WebRTC,您可以使用 DataChannels over SRTP和 ICE 作为可能的解决方案。
See Also:
也可以看看:
回答by natchiketa
You can use both TCP and UDP connections with the chrome.socket API, but this is only for Packaged Apps(i.e. apps that are bundled in a container to be run as desktop apps).
您可以通过chrome.socket API使用 TCP 和 UDP 连接,但这仅适用于打包应用程序(即捆绑在容器中以作为桌面应用程序运行的应用程序)。
The API was available for a while for Chrome extensions, when it was in experimental status (see this answer, from a user who works at Googleand was co-presenter for Packaged Apps at Google I/O 2012)
该 API 可用于 Chrome 扩展程序一段时间,当时它处于实验状态(请参阅此答案,来自在 Google 工作并且是Google I/O 2012 打包应用程序的联合演示者的用户)