Loading...
Searching...
No Matches
juce::InterprocessConnectionServer Class Referenceabstract

## Detailed Description

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.

See also
  InterprocessConnection

The documentation for this class was generated from the following file:

- juce_events/interprocess/juce_InterprocessConnectionServer.h

Inheritance diagram for juce::InterprocessConnectionServer:

## Public Member Functions

| InterprocessConnectionServer ()
| Creates an uninitialised server object.
| ~InterprocessConnectionServer () override
| Destructor.
bool | beginWaitingForSocket (int portNumber, const String &bindAddress=String())
| Starts an internal thread which listens on the given port number.
void | stop ()
| Terminates the listener thread, if it's active.
int | getBoundPort () const noexcept
| Returns the local port number to which this server is currently bound.

## Protected Member Functions

virtual InterprocessConnection * | createConnectionObject ()=0
| Creates a suitable connection object for a client process that wants to connect to this one.

## Constructors and Destructors

## InterprocessConnectionServer()

juce::InterprocessConnectionServer::InterprocessConnectionServer | ( |  | ) |

Creates an uninitialised server object.

Referenced by createConnectionObject().

## ~InterprocessConnectionServer()

juce::InterprocessConnectionServer::~InterprocessConnectionServer | ( |  | ) |

override

Destructor.

## Member Functions

## beginWaitingForSocket()

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.

Parameters

  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.

See also
  createConnectionObject, stop

## stop()

void juce::InterprocessConnectionServer::stop | ( |  | ) |

Terminates the listener thread, if it's active.

See also
  beginWaitingForSocket

## getBoundPort()

int juce::InterprocessConnectionServer::getBoundPort | ( |  | ) | const

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.

## createConnectionObject()

virtual InterprocessConnection * juce::InterprocessConnectionServer::createConnectionObject | ( |  | ) |

protected pure 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.

See also
  InterprocessConnection

References createConnectionObject(), InterprocessConnectionServer(), and JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR.

Referenced by createConnectionObject().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited