roNetworkDiscovery
Â
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 roNetworkAdvertisement 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 playername
: The service nametxt
: An associative array containing arbitrary text entries specified during instantiation of the roNetworkAdvertisement instance.domain
: The domain of the playertype
: The service typeaddress
: 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
Â