Loading...
Searching...
No Matches
NetworkServiceDiscovery::AvailableServiceList Struct Reference

Watches the network for broadcasts from Advertiser objects, and keeps a list of all the currently active instances. More...

#include <juce_NetworkServiceDiscovery.h>

Inheritance diagram for NetworkServiceDiscovery::AvailableServiceList:

Public Member Functions

 AvailableServiceList (const String &serviceTypeUID, int broadcastPort)
 Creates an AvailableServiceList that will bind to the given port number and watch the network for Advertisers broadcasting the given service type.
 
 ~AvailableServiceList () override
 Destructor.
 
std::vector< ServicegetServices () const
 Returns a list of the currently known services.
 

Public Attributes

std::function< void()> onChange
 A lambda that can be set to receive a callback when the list changes.
 

Detailed Description

Watches the network for broadcasts from Advertiser objects, and keeps a list of all the currently active instances.

Just create an instance of AvailableServiceList and it will start listening - you can register a callback with its onChange member to find out when services appear/disappear, and you can call getServices() to find out the current list.

See also
Service, Advertiser

Constructor & Destructor Documentation

◆ AvailableServiceList()

NetworkServiceDiscovery::AvailableServiceList::AvailableServiceList ( const String & serviceTypeUID,
int broadcastPort )

Creates an AvailableServiceList that will bind to the given port number and watch the network for Advertisers broadcasting the given service type.

This will only detect broadcasts from an Advertiser object with a matching serviceTypeUID value, and where the broadcastPort matches.

◆ ~AvailableServiceList()

NetworkServiceDiscovery::AvailableServiceList::~AvailableServiceList ( )
override

Destructor.

Member Function Documentation

◆ getServices()

std::vector< Service > NetworkServiceDiscovery::AvailableServiceList::getServices ( ) const

Returns a list of the currently known services.

Member Data Documentation

◆ onChange

std::function<void()> NetworkServiceDiscovery::AvailableServiceList::onChange

A lambda that can be set to receive a callback when the list changes.


The documentation for this struct was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram