1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a function to the InterprocessConnectionServer class to get the bound port number

This commit is contained in:
tpoole 2017-08-30 09:55:56 +01:00
parent 768163f75c
commit ff6d01bc25
3 changed files with 16 additions and 2 deletions

View file

@ -58,6 +58,11 @@ void InterprocessConnectionServer::stop()
socket = nullptr;
}
int InterprocessConnectionServer::getBoundPort() const noexcept
{
return (socket == nullptr) ? -1 : socket->getBoundPort();
}
void InterprocessConnectionServer::run()
{
while ((! threadShouldExit()) && socket != nullptr)

View file

@ -71,6 +71,15 @@ public:
*/
void stop();
/** 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.
*/
int getBoundPort() const noexcept;
protected:
/** Creates a suitable connection object for a client process that wants to
connect to this one.
@ -83,7 +92,6 @@ protected:
*/
virtual InterprocessConnection* createConnectionObject() = 0;
private:
//==============================================================================
ScopedPointer<StreamingSocket> socket;