OpenShot Audio Library | OpenShotAudio 0.3.2
|
#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 |
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.
Definition at line 39 of file juce_InterprocessConnectionServer.h.
juce::InterprocessConnectionServer::InterprocessConnectionServer | ( | ) |
Creates an uninitialised server object.
Definition at line 26 of file juce_InterprocessConnectionServer.cpp.
|
override |
Destructor.
Definition at line 30 of file juce_InterprocessConnectionServer.cpp.
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. |
Definition at line 36 of file juce_InterprocessConnectionServer.cpp.
|
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.
Definition at line 63 of file juce_InterprocessConnectionServer.cpp.
void juce::InterprocessConnectionServer::stop | ( | ) |
Terminates the listener thread, if it's active.
Definition at line 52 of file juce_InterprocessConnectionServer.cpp.
Referenced by beginWaitingForSocket(), and ~InterprocessConnectionServer().