RADLib
RADical C++ application framework
RADNet::RADProtocolServer Class Reference

Framed protocol TCP server. More...

#include <RADNet.h>

+ Inheritance diagram for RADNet::RADProtocolServer:
+ Collaboration diagram for RADNet::RADProtocolServer:

Public Member Functions

 RADProtocolServer (RADCore::EventLoop &loop)
 Creates a server. More...
 
bool listenUsingConfig (const RADProtocolEndpointConfig &config)
 Starts listening using config. More...
 
void close ()
 Stops listening. More...
 
uint16_t localPort () const
 Returns bound local port. More...
 
void handleNewConnection (std::shared_ptr< RADNet::RADTcpSocket > socket)
 Internal TCP accept handler. More...
 
void handleError (std::string message)
 Internal error handler. More...
 
- Public Member Functions inherited from RADCore::RADObject
 RADObject ()
 Creates a RADObject bound to the current thread. More...
 
virtual ~RADObject ()
 Disconnects tracked event links and releases lifetime token. More...
 
void registerLink (const ConnectionRecord &record)
 Registers a connection for cleanup when this object is destroyed. More...
 
std::thread::id threadId () const
 Returns the thread id this object is currently associated with. More...
 
EventLoopassociatedEventLoop () const
 Returns the associated event loop, if any. More...
 
ThreadAffinity threadAffinity () const
 Returns both thread id and associated loop atomically. More...
 
std::weak_ptr< void > lifetimeToken () const
 Returns a weak token used to drop queued callbacks after destruction. More...
 
void moveToThread (std::thread::id tId, EventLoop *loop=nullptr)
 Moves the object's affinity to tId and optional loop. More...
 

Public Attributes

RADCore::Event< void(std::shared_ptr< RADNet::RADProtocolSocket >) > newConnection
 Raised when a framed client is accepted. More...
 
RADCore::Event< void(std::string) > errorOccurred
 Raised when listening or accepting fails. More...
 

Detailed Description

Framed protocol TCP server.

Constructor & Destructor Documentation

◆ RADProtocolServer()

RADNet::RADProtocolServer::RADProtocolServer ( RADCore::EventLoop loop)
explicit

Creates a server.

Member Function Documentation

◆ close()

void RADNet::RADProtocolServer::close ( )

Stops listening.

◆ handleError()

void RADNet::RADProtocolServer::handleError ( std::string  message)

Internal error handler.

◆ handleNewConnection()

void RADNet::RADProtocolServer::handleNewConnection ( std::shared_ptr< RADNet::RADTcpSocket socket)

Internal TCP accept handler.

◆ listenUsingConfig()

bool RADNet::RADProtocolServer::listenUsingConfig ( const RADProtocolEndpointConfig config)

Starts listening using config.

◆ localPort()

uint16_t RADNet::RADProtocolServer::localPort ( ) const

Returns bound local port.

Member Data Documentation

◆ errorOccurred

RADCore::Event<void (std::string) > RADNet::RADProtocolServer::errorOccurred

Raised when listening or accepting fails.

◆ newConnection

RADCore::Event<void (std::shared_ptr<RADNet::RADProtocolSocket>) > RADNet::RADProtocolServer::newConnection

Raised when a framed client is accepted.


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