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


Public Member Functions | |
| Client (const DeserializePacketFunction &deserialize_packet_function, std::shared_ptr< Logger::Log > logger) noexcept | |
Constructs a Client instance. | |
| Client (const Client &other)=delete | |
| Copy constructor (deleted). | |
| Client (Client &&other) noexcept=default | |
| Move constructor. | |
| virtual | ~Client () noexcept |
| Virtual destructor (abstract). | |
| Client & | operator= (const Client &other)=delete |
| Copy-assignment operator (deleted). | |
| Client & | operator= (Client &&other) noexcept=default |
| Move-assignment operator. | |
| bool | Connect (const Connection::Protocol &protocol, const std::string &address, const unsigned short &port) override |
| Establish a connection to a server. | |
| void | Disconnect () noexcept override |
| Disconnect from the server, if connected. | |
| Connection::Status | Status () const noexcept override |
| Query the current connection status. | |
Protected Member Functions | |
| PacketPointer | Send (const Transport::Packet &packet) noexcept |
Send a Transport::Packet to the connected server and receive a reply. | |
Abstract base class for application-specific clients.
Derive from Client to implement your application's client-side logic. The modern API expects a deserializer function (see DeserializePacketFunction) and a Logger::ThreadedLog instance to be provided to the Client constructor. Subclasses typically implement lightweight, domain-specific helper methods that call the protected Send() helper to perform synchronous request/response flows.
Key extension points:
InputPipeline() and OutputPipeline() to return any Buffer::Pipeline stages required by your application (compression, encryption, framing, etc.). Return an empty pipeline when no processing is required (the common case in tests/examples).The protected Send() helper sends a Transport::Packet to the server and returns a PacketPointer referencing the reply (or nullptr on failure). Use Connect() / Disconnect() to manage the connection.
|
inlinenoexcept |
Constructs a Client 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 (abstract).
Kept pure to make Client abstract; derived classes must provide an implementation (even if defaulted) in a translation unit.
|
overridevirtual |
Establish a connection to a server.
| protocol | Protocol parameters to use for the connection. |
| address | Server address (hostname or IP string). |
| port | Server port number. |
true if the connection was established, false otherwise. Implements StormByte::Network::Endpoint.
|
overridevirtualnoexcept |
Disconnect from the server, if connected.
Implements StormByte::Network::Endpoint.
|
protectednoexcept |
Send a Transport::Packet to the connected server and receive a reply.
Subclasses should use this protected helper to perform request/response interactions with the server. The function returns a PacketPointer referencing the response packet, or nullptr if the send or receive operation failed.
| packet | The transport-level packet to send. |
PacketPointer to the response packet, or nullptr on error.
|
overridevirtualnoexcept |
Query the current connection status.
Connection::Status representing the connection state. Implements StormByte::Network::Endpoint.