How to send UDP packet using javascript to local network broadcast
Asked Answered
C

1

7

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?

Converse answered 12/2, 2018 at 3:19 Comment(4)
Thanks for the comment. I've edited the question, I mean network broadcast eg: 192.168.1.255Converse
nodejs.org/api/dgram.htmlPuritanical
So the only solution is to use nodejs?Converse
No, you could use any other JS runtime, but you definitely can't send arbitrary UDP packets from a browser context.Puritanical
C
18

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

Converse answered 17/2, 2018 at 15:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.