StormByte C++ Library: Network module 1.1.0
StormByte-Network is the C++26 networking module of the StormByte suite.
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | List of all members
StormByte::Network::Server Class Referenceabstract

Abstract application server. More...

#include <StormByte/network/server.hxx>

Inheritance diagram for StormByte::Network::Server:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Network::Server:
Collaboration graph
[legend]

Public Member Functions

 Server (const DeserializePacketFunction &deserialize_packet_function, std::shared_ptr< Logger::Log > logger) noexcept
 Construct with a packet factory and a logger.
 
 Server (const Server &other)=delete
 Copy constructor (deleted).
 
 Server (Server &&other) noexcept
 Move constructor.
 
virtual ~Server () noexcept
 Destructor (joins threads, disconnects clients).
 
Serveroperator= (const Server &other)=delete
 Copy assignment (deleted).
 
Serveroperator= (Server &&other) noexcept
 Move assignment.
 
bool Connect (const Connection::Protocol &protocol, const std::string &address, const unsigned short &port) override
 Bind, listen and start the accept thread.
 
void Disconnect () noexcept override
 Stop accept, disconnect clients and close the listener.
 
Connection::Status Status () const noexcept override
 Listener / server status.
 

Protected Member Functions

void DisconnectClient (const std::string &uuid) noexcept
 Disconnect a client by UUID.
 

Detailed Description

Abstract application server.

Listen socket and single-threaded event loop. Implement ProcessClientPacket(); override pipelines as needed.

Note
Inheritance-oriented. Subclass required.

Constructor & Destructor Documentation

◆ Server() [1/3]

StormByte::Network::Server::Server ( const DeserializePacketFunction deserialize_packet_function,
std::shared_ptr< Logger::Log >  logger 
)
noexcept

Construct with a packet factory and a logger.

Parameters
deserialize_packet_functionBuilds domain packets from wire data.
loggerDiagnostic logger.

◆ Server() [2/3]

StormByte::Network::Server::Server ( const Server other)
delete

Copy constructor (deleted).

◆ Server() [3/3]

StormByte::Network::Server::Server ( Server &&  other)
noexcept

Move constructor.

◆ ~Server()

virtual StormByte::Network::Server::~Server ( )
virtualnoexcept

Destructor (joins threads, disconnects clients).

Member Function Documentation

◆ Connect()

bool StormByte::Network::Server::Connect ( const Connection::Protocol protocol,
const std::string &  address,
const unsigned short &  port 
)
overridevirtual

Bind, listen and start the accept thread.

Parameters
protocolAddress family.
addressBind address.
portPort number.
Returns
true on success.

Implements StormByte::Network::Endpoint.

◆ Disconnect()

void StormByte::Network::Server::Disconnect ( )
overridevirtualnoexcept

Stop accept, disconnect clients and close the listener.

Implements StormByte::Network::Endpoint.

◆ DisconnectClient()

void StormByte::Network::Server::DisconnectClient ( const std::string &  uuid)
protectednoexcept

Disconnect a client by UUID.

Parameters
uuidClient UUID.

◆ operator=() [1/2]

Server & StormByte::Network::Server::operator= ( const Server other)
delete

Copy assignment (deleted).

◆ operator=() [2/2]

Server & StormByte::Network::Server::operator= ( Server &&  other)
noexcept

Move assignment.

◆ Status()

Connection::Status StormByte::Network::Server::Status ( ) const
inlineoverridevirtualnoexcept

Listener / server status.

Returns
Status.

Implements StormByte::Network::Endpoint.


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