Player APIs (BrightScript & Ja...
...
Object Reference
Networking Objects

roDatagramReceiver

6min
this object can receive multicast packets, but it doesn't have a way to explicitly join a multicast group therefore, this object is not suitable for multicast use use docid\ zudwydm6ehqov lvi3xm for multicast receiving this object sends rodatagramevent instances to a message port when udp packets are received on a specified port the javascript equivalent is node js dgram api object creation the rodatagramreceiver object is created with a port parameter, which specifies the port on which to receive udp packets createobject("rodatagramreceiver ", port as integer) ifuserdata setuserdata(user data as object) sets the user data that will be returned when events are raised getuserdata() as object returns the user data that has previously been set via setuserdata() it will return invalid if no data has been set ifidentity getidentity() as integer the ifidentity interface has been deprecated we recommend using the ifuserdata interface instead ifmessageport setport(port as romessageport) posts messages of type rodatagramevent to the attached message port this example script listens for udp packets on port 21075 receiver = createobject("rodatagramreceiver", 21075) mp = createobject("romessageport") receiver setport(mp) while true event = mp waitmessage(0) if type(event) = "rodatagramevent" then print "datagram "; event endif end while