Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send UDP packet using javascript to local network broadcast

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?

like image 576
Amer.k Avatar asked Feb 12 '18 03:02

Amer.k


People also ask

Can Javascript use UDP?

Because of Security Concern, JS doesn't allow UDP port communication from browser.

Can browser send UDP?

UDP packets are not encrypted, so any data sent over these packets could be sniffed and read by an attacker, or even modified in transmit. It would be a massive step back for web security to create a new way for browsers to send unencrypted packets.


1 Answers

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

like image 84
Amer.k Avatar answered Sep 29 '22 07:09

Amer.k