AvogadroApp
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | List of all members
ConnectionListener Class Referenceabstract

#include <connectionlistener.h>

Inheritance diagram for ConnectionListener:
LocalSocketConnectionListener

Public Types

enum  Error {
  AddressInUseError ,
  UnknownError = -1
}
 

Signals

void newConnection (Avogadro::RPC::Connection *connection)
 
void connectionError (Avogadro::RPC::ConnectionListener::Error errorCode, const QString &message)
 

Public Member Functions

 ConnectionListener (QObject *parentObject=nullptr)
 
virtual void start ()=0
 
virtual void stop (bool force)=0
 
virtual void stop ()=0
 
virtual QString connectionString () const =0
 

Detailed Description

The ConnectionListener class is an interface defining a listener waiting for connections to a server. Implementations should emit the newConnection() signal. Subclasses provide concrete implementations, for example based on local sockets.

<avogadro/rpc/connectionlistener.h>

See also
LocalSocketConnectionListener

Member Enumeration Documentation

◆ Error

enum Error

Defines the errors that will be emitted by connectionError()

Member Function Documentation

◆ start()

virtual void start ( )
pure virtual

Start the connection listener, start listening for incoming connections.

Implemented in LocalSocketConnectionListener.

◆ stop() [1/2]

virtual void stop ( bool  force)
pure virtual

Stop the connection listener.

Parameters
forceif true, "extreme" measures may be taken to stop the listener.

Implemented in LocalSocketConnectionListener.

◆ stop() [2/2]

virtual void stop ( )
pure virtual

Stop the connection listener without forcing it, equivalent to stop(false)

Implemented in LocalSocketConnectionListener.

◆ connectionString()

virtual QString connectionString ( ) const
pure virtual
Returns
the "address" the listener will listen on.

Implemented in LocalSocketConnectionListener.

◆ newConnection

void newConnection ( Avogadro::RPC::Connection connection)
signal

Emitted when a new connection is received. The new connection is only valid for the lifetime of the connection listener instance that emitted it.

◆ connectionError

void connectionError ( Avogadro::RPC::ConnectionListener::Error  errorCode,
const QString &  message 
)
signal

Emitted when an error occurs.

Parameters
errorCodeThe error code
See also
Error
Parameters
messageThe error message provided by the implementation.