最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to send UDP packet using javascript to local network broadcast - Stack Overflow

programmeradmin0浏览0评论

I have build an android application that listen to the UDP broadcast url (eg: 192.168.1.255), and a website that should send a UDP packet to the broadcast url to find all devices connected to the same network at the moment, that will respond to the broadcast message by sending another broadcast to the same url. is there anyway to send UDP packet using native javascript? if not is there any alternative?

I have build an android application that listen to the UDP broadcast url (eg: 192.168.1.255), and a website that should send a UDP packet to the broadcast url to find all devices connected to the same network at the moment, that will respond to the broadcast message by sending another broadcast to the same url. is there anyway to send UDP packet using native javascript? if not is there any alternative?

Share Improve this question edited Feb 12, 2018 at 4:21 Amer.k asked Feb 12, 2018 at 3:19 Amer.kAmer.k 3791 gold badge2 silver badges9 bronze badges 4
  • Thanks for the comment. I've edited the question, I mean network broadcast eg: 192.168.1.255 – Amer.k Commented Feb 12, 2018 at 4:22
  • 1 nodejs.org/api/dgram.html – Brad Commented Feb 12, 2018 at 6:53
  • So the only solution is to use nodejs? – Amer.k Commented Feb 12, 2018 at 13:36
  • 1 No, you could use any other JS runtime, but you definitely can't send arbitrary UDP packets from a browser context. – Brad Commented Feb 12, 2018 at 17:49
Add a comment  | 

1 Answer 1

Reset to default 18

After so many research and asking, looks like there is no way to send UDP packet from native javascript due to security concerns

发布评论

评论列表(0)

  1. 暂无评论