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

roNetworkDiscovery

7min
this object allows for zeroconf discovery of devices on the local network (including other brightsign players) using mdns other brightsign players must be running an instance of docid\ yqwtvcjm15y4g2jnw5d5y to be discovered using the ronetworkdiscovery object object creation the ronetworkdiscovery object is created with no parameters createobject("ronetworkdiscovery") ifnetworkdiscovery search(parameters as roassociativearray) as boolean searches for brightsign players on the local network a player will only respond to the search if it is currently running an instance of ronetworkadvertisement search results will be posted to the attached message port search parameters are passed to this method as an associative array containing the following values type the service type if this entry is omitted, the search will default to " http tcp" protocol the ip protocol acceptable values are "ipv4" and "ipv6" you can also omit this entry if you wish to search for players using either protocol ifmessageport setport(port as romessageport) posts events to the attached message port see the event types section below for more details 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 event types the ronetworkdiscovery object can post three event object types to the attached message port ronetworkdiscoveryresolvedevent raised when a host is fully resolved ronetworkdiscoverycompletedevent raised when the search is complete ronetworkdiscoverygeneralevent raised for events other than the above two this event rarely occurs all three event objects offer the setuserdata() , getuserdata() , and getdata() methods use getdata() to retrieve an associative array of results for the ronetworkdiscoveryresolvedevent object, calling getdata() will return the following entries protocol the network protocol family that was used for discovery, either "ipv4" or "ipv6" note that this is not necessarily the address family for the returned address; it is possible for ipv6 addresses to be advertised over an ipv4 transport, or vice versa host name the hostname of the player name the service name txt an associative array containing arbitrary text entries specified during instantiation of the ronetworkadvertisement instance domain the domain of the player type the service type address the ipv4 or ipv6 address the following script searches for a player running an ronetworkadvertisement instance and prints the results of the discovery rn = createobject("ronetworkdiscovery") mp = createobject("romessageport") rn setport(mp) params = {} rn search(params) complete = false while not complete ev = mp waitmessage(10000) if ev = invalid then stop end if if type(ev) = "ronetworkdiscoverycompletedevent" then print "ronetworkdiscoverycompletedevent" end if if type(ev) = "ronetworkdiscoverygeneralevent" then print "ronetworkdiscoverygeneralevent" end if if type(ev) = "ronetworkdiscoveryresolvedevent" then complete = true data = ev getdata() print "data "; data print "done" textdata = data\[ "txt" ] if textdata <> invalid then print "text "; textdata endif end if end while