研究在互联网上( 如何发送UDP到UDP的node.js服务器? , JavaScript的的WebSockets与UDP? )我发现,这是不可能的JavaScript发送UDP数据包。
在另一方面,有些网页声称Chrome浏览器是能够做到这一点。 例如链接:
http://blog.alexmaccaw.com/chrome-tcp-udp
声称,谷歌浏览器能够发送UDP数据包。 也许我做错了什么。 如果这是真的,铬可以发送UDP数据包,我将不胜感激,如果有人可以张贴一个Hello World例子。 我试图从我的链接显示例子,这是行不通的。 也许我做错了什么。
From the linked page:
Chrome Canary now has support for raw TCP and UDP sockets in its
‘experimental’ APIs. These features are only available for extensions
and, although documented, are hidden for the moment.
So, develop an extension and it should work. Actually, that article from May '12 seems to be outdated as the chrome.socket
module now has lost its experimental
status. For the HelloWorld, you might check out their udp sample which is linked from the official pages.