|
StormByte C++ Library: Network module 0.0.9999
StormByte-Network is a StormByte library module for handling and create network connections
|
Abstract base for application-specific servers. More...
#include <server.hxx>


Public Member Functions | |
| Server (const DeserializePacketFunction &deserialize_packet_function, std::shared_ptr< Logger::Log > logger) noexcept | |
Constructs a Server instance. | |
| Server (const Server &other)=delete | |
| Copy constructor (deleted). | |
| Server (Server &&other) noexcept=default | |
| Move constructor. | |
| virtual | ~Server () noexcept |
| Virtual destructor. | |
| Server & | operator= (const Server &other)=delete |
| Copy-assignment operator (deleted). | |
| Server & | operator= (Server &&other) noexcept=default |
| Move-assignment operator. | |
| bool | Connect (const Connection::Protocol &protocol, const std::string &address, const unsigned short &port) override |
| Start the server and begin listening for connections. | |
| void | Disconnect () noexcept override |
| Stop the server and disconnect all clients. | |
| Connection::Status | Status () const noexcept override |
| Gets the current server connection status. | |
Protected Member Functions | |
| void | DisconnectClient (const std::string &uuid) noexcept |
| Disconnects a client by UUID. | |
Abstract base for application-specific servers.
Subclass Server to implement your server-side application logic. The constructor accepts a DeserializePacketFunction and a Logger::ThreadedLog instance; the deserializer converts opcode + payload bytes into concrete Transport::Packet instances used by the framework.
Key extension points:
ProcessClientPacket() to inspect incoming packets and return a PacketPointer that will be sent back to the requesting client. If error return nullptr.InputPipeline() and OutputPipeline() to add buffer preprocessing/postprocessing stages (compression, encryption, etc.).Implementation notes:
Server base manages listening, accepting, per-client threads and the underlying socket server; application logic should reside in ProcessClientPacket() or other overridable helpers.
|
noexcept |
Constructs a Server instance.
| deserialize_packet_function | Function used to deserialize incoming transport packets into domain Packet objects. |
| logger | Logger instance used for diagnostic messages. |
|
virtualnoexcept |
Virtual destructor.
Declared pure to make Server an abstract base. Concrete subclasses must provide an implementation for the destructor (even if defaulted) in their translation unit.
|
overridevirtual |
Start the server and begin listening for connections.
| protocol | The protocol to use for the server. |
| address | The address to bind to. |
| port | The port to listen on. |
Implements StormByte::Network::Endpoint.
|
overridevirtualnoexcept |
Stop the server and disconnect all clients.
Implements StormByte::Network::Endpoint.
|
protectednoexcept |
Disconnects a client by UUID.
| client_uuid | The UUID of the client to be disconnected. |
|
inlineoverridevirtualnoexcept |
Gets the current server connection status.
Implements StormByte::Network::Endpoint.