LMMS
Loading...
Searching...
No Matches
juce::NetworkServiceDiscovery::Advertiser Struct Reference

#include <juce_NetworkServiceDiscovery.h>

Inheritance diagram for juce::NetworkServiceDiscovery::Advertiser:
juce::Thread

Public Member Functions

 Advertiser (const String &serviceTypeUID, const String &serviceDescription, int broadcastPort, int connectionPort, RelativeTime minTimeBetweenBroadcasts=RelativeTime::seconds(1.5))
 ~Advertiser () override

Private Member Functions

void run () override
void sendBroadcast ()
Private Member Functions inherited from juce::Thread
 Thread (const String &threadName, size_t threadStackSize=0)
virtual ~Thread ()
void startThread ()
void startThread (int priority)
bool stopThread (int timeOutMilliseconds)
bool isThreadRunning () const
void signalThreadShouldExit ()
bool threadShouldExit () const
bool waitForThreadToExit (int timeOutMilliseconds) const
void addListener (Listener *)
void removeListener (Listener *)
bool setPriority (int priority)
void setAffinityMask (uint32 affinityMask)
bool wait (int timeOutMilliseconds) const
void notify () const
ThreadID getThreadId () const noexcept
const StringgetThreadName () const noexcept

Private Attributes

XmlElement message
const int broadcastPort
const RelativeTime minInterval
DatagramSocket socket { true }

Additional Inherited Members

Private Types inherited from juce::Thread
enum  { realtimeAudioPriority = -1 }
using ThreadID = void*
Static Private Member Functions inherited from juce::Thread
static void launch (std::function< void()> functionToRun)
static bool currentThreadShouldExit ()
static bool setCurrentThreadPriority (int priority)
static void JUCE_CALLTYPE setCurrentThreadAffinityMask (uint32 affinityMask)
static void JUCE_CALLTYPE sleep (int milliseconds)
static void JUCE_CALLTYPE yield ()
static ThreadID JUCE_CALLTYPE getCurrentThreadId ()
static Thread *JUCE_CALLTYPE getCurrentThread ()
static void JUCE_CALLTYPE setCurrentThreadName (const String &newThreadName)

Detailed Description

An object which runs a thread to repeatedly broadcast the existence of a discoverable service.

To use, simply create an instance of an Advertiser and it'll broadcast until you delete it.

@tags{Events}

Constructor & Destructor Documentation

◆ Advertiser()

juce::NetworkServiceDiscovery::Advertiser::Advertiser ( const String & serviceTypeUID,
const String & serviceDescription,
int broadcastPort,
int connectionPort,
RelativeTime minTimeBetweenBroadcasts = RelativeTime::seconds (1.5) )

Creates and starts an Advertiser thread, broadcasting with the given properties.

Parameters
serviceTypeUIDA user-supplied string to define the type of service this represents
serviceDescriptionA description string that will appear in the Service::description field for clients
broadcastPortThe port number on which to broadcast the service discovery packets
connectionPortThe port number that will be sent to appear in the Service::port field
minTimeBetweenBroadcastsThe interval to wait between sending broadcast messages

◆ ~Advertiser()

juce::NetworkServiceDiscovery::Advertiser::~Advertiser ( )
override

Destructor

Member Function Documentation

◆ run()

void juce::NetworkServiceDiscovery::Advertiser::run ( )
overrideprivatevirtual

Must be implemented to perform the thread's actual code.

Remember that the thread must regularly check the threadShouldExit() method whilst running, and if this returns true it should return from the run() method as soon as possible to avoid being forcibly killed.

See also
threadShouldExit, startThread

Implements juce::Thread.

◆ sendBroadcast()

void juce::NetworkServiceDiscovery::Advertiser::sendBroadcast ( )
private

Member Data Documentation

◆ broadcastPort

const int juce::NetworkServiceDiscovery::Advertiser::broadcastPort
private

◆ message

XmlElement juce::NetworkServiceDiscovery::Advertiser::message
private

◆ minInterval

const RelativeTime juce::NetworkServiceDiscovery::Advertiser::minInterval
private

◆ socket

DatagramSocket juce::NetworkServiceDiscovery::Advertiser::socket { true }
private

The documentation for this struct was generated from the following files: