|
LMMS
|
#include <juce_InterprocessConnectionServer.h>
Public Member Functions | |
| InterprocessConnectionServer () | |
| ~InterprocessConnectionServer () override | |
| bool | beginWaitingForSocket (int portNumber, const String &bindAddress=String()) |
| void | stop () |
| int | getBoundPort () const noexcept |
Protected Member Functions | |
| virtual InterprocessConnection * | createConnectionObject ()=0 |
Private Member Functions | |
| void | run () override |
| 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 String & | getThreadName () const noexcept |
Private Attributes | |
| std::unique_ptr< StreamingSocket > | socket |
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) |
An object that waits for client sockets to connect to a port on this host, and creates InterprocessConnection objects for each one.
To use this, create a class derived from it which implements the createConnectionObject() method, so that it creates suitable connection objects for each client that tries to connect.
@tags{Events}
| juce::InterprocessConnectionServer::InterprocessConnectionServer | ( | ) |
Creates an uninitialised server object.
|
override |
Destructor.
| bool juce::InterprocessConnectionServer::beginWaitingForSocket | ( | int | portNumber, |
| const String & | bindAddress = String() ) |
Starts an internal thread which listens on the given port number.
While this is running, if another process tries to connect with the InterprocessConnection::connectToSocket() method, this object will call createConnectionObject() to create a connection to that client.
Use stop() to stop the thread running.
| portNumber | The port on which the server will receive connections |
| bindAddress | The address on which the server will listen for connections. An empty string indicates that it should listen on all addresses assigned to this machine. |
|
protectedpure virtual |
Creates a suitable connection object for a client process that wants to connect to this one.
This will be called by the listener thread when a client process tries to connect, and must return a new InterprocessConnection object that will then run as this end of the connection.
|
noexcept |
Returns the local port number to which this server is currently bound.
This is useful if you need to know to which port the OS has actually bound your socket when calling beginWaitingForSocket with a port number of zero.
Returns -1 if the function fails.
|
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.
Implements juce::Thread.
| void juce::InterprocessConnectionServer::stop | ( | ) |
Terminates the listener thread, if it's active.
|
private |