MIRA
Public Member Functions | Protected Attributes | List of all members
RemoteServer Class Reference

Server class handling incoming connections from remote frameworks. More...

#include <fw/RemoteServer.h>

Public Member Functions

 RemoteServer (uint16 port)
 Constructs a server that listens on the given port. More...
 
 ~RemoteServer ()
 Destructor. Stops server. More...
 
void handleAccept (const boost::system::error_code &error)
 Connection handler. More...
 
void startListening ()
 
void run (std::size_t threadCount=0, bool runInThisThread=true)
 Runs the server with the given number of threads. More...
 
void stop ()
 Stop the server. More...
 
uint16 getPort () const
 Returns the port of the server. More...
 

Protected Attributes

IOService mService
 
boost::asio::ip::tcp::acceptor mAcceptor
 
RemoteConnectionProxy mPendingConnection
 

Detailed Description

Server class handling incoming connections from remote frameworks.

Constructor & Destructor Documentation

◆ RemoteServer()

RemoteServer ( uint16  port)

Constructs a server that listens on the given port.

◆ ~RemoteServer()

Destructor. Stops server.

Member Function Documentation

◆ handleAccept()

void handleAccept ( const boost::system::error_code &  error)

Connection handler.

Gets called when a client connects.

Parameters
[in]errorThe error flag

◆ startListening()

void startListening ( )

◆ run()

void run ( std::size_t  threadCount = 0,
bool  runInThisThread = true 
)

Runs the server with the given number of threads.

Note
When using TCPAsyncConnection as connection class, all clients will get the same underlying io_service object. This means all clients share the same thread(s). Keep in mind to start with more threads if you expect many connections at a time.
Parameters
[in]threadCountThe number of threads to launch
[in]runInThisThreadIf true this method will block until the server stops.

◆ stop()

void stop ( )

Stop the server.

◆ getPort()

uint16 getPort ( ) const
inline

Returns the port of the server.

Member Data Documentation

◆ mService

IOService mService
protected

◆ mAcceptor

boost::asio::ip::tcp::acceptor mAcceptor
protected

◆ mPendingConnection

RemoteConnectionProxy mPendingConnection
protected

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