Player APIs (BrightScript & Ja...
BrightScript-JavaScript Object...

BSDatagramSocket

5min
for more information about available methods, refer to the rodatagramreceiver and rodatagramevent entries methods boolean bindlocalport(in long port) long getlocalport() boolean joinmulticastgroup(in domstring group) boolean sendto(in domstring dest, in long port, in arraybufferview data) boolean sendto(in domstring dest, in long port, in domstring data) void close() shuts down the instance, preventing it from further consuming resources if this method is not called, garbage collection determines when the instance will be destroyed events the following event is available on the bsdatagramsocket object it can receive an event of the type datagramsocketevent use getbytes() to retrieve the body of the udp message ondatagram datagramsocketevent the datagramsocketevent has the following attributes readonly attribute domstring remotehost readonly attribute int remoteport the datagramsocketevent supports the following methods arraybuffer getbytes() example see here https //stackoverflow\ com/questions/6965107/converting between strings and arraybuffers to learn how to convert between strings and an arraybuffer var bssocketmessage = new bsdatagramsocket(); bssocketmessage bindlocalport(1234) bssocketmessage ondatagram = function(e){ var txtdec = new textdecoder("utf 8"); console log("received " + txtdec decode(e getbytes())); };