42 if (socket->createListener (portNumber, bindAddress))
56 if (socket !=
nullptr)
65 return (socket ==
nullptr) ? -1 : socket->getBoundPort();
68 void InterprocessConnectionServer::run()
72 std::unique_ptr<StreamingSocket> clientSocket (socket->waitForNextConnection());
74 if (clientSocket !=
nullptr)
76 newConnection->initialiseWithSocket (clientSocket.release());
InterprocessConnectionServer()
Creates an uninitialised server object.
bool stopThread(int timeOutMilliseconds)
Attempts to stop the thread running.
void signalThreadShouldExit()
Sets a flag to tell the thread it should stop.
virtual InterprocessConnection * createConnectionObject()=0
Creates a suitable connection object for a client process that wants to connect to this one...
~InterprocessConnectionServer() override
Destructor.
A wrapper for a streaming (TCP) socket.
bool threadShouldExit() const
Checks whether the thread has been told to stop running.
void stop()
Terminates the listener thread, if it's active.
bool beginWaitingForSocket(int portNumber, const String &bindAddress=String())
Starts an internal thread which listens on the given port number.
int getBoundPort() const noexcept
Returns the local port number to which this server is currently bound.
void startThread()
Starts the thread running.