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

Abstract application client. More...

#include <StormByte/network/client.hxx>

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

Public Member Functions

 Client (const DeserializePacketFunction &deserialize_packet_function, std::shared_ptr< Logger::Log > logger) noexcept
 Construct with a packet factory and a logger.
 
 Client (const Client &other)=delete
 Copy constructor (deleted).
 
 Client (Client &&other) noexcept=default
 Move constructor.
 
virtual ~Client () noexcept
 Destructor (out-of-line in .cxx).
 
Clientoperator= (const Client &other)=delete
 Copy assignment (deleted).
 
Clientoperator= (Client &&other) noexcept=default
 Move assignment.
 
bool Connect (const Connection::Protocol &protocol, const std::string &address, const unsigned short &port) override
 Connect to a remote host.
 
void Disconnect () noexcept override
 Disconnect if connected.
 
Connection::Status Status () const noexcept override
 Current connection status.
 

Protected Member Functions

PacketPointer Send (const Transport::Packet &packet) noexcept
 Send packet and return the response (or nullptr).
 

Detailed Description

Abstract application client.

Derive and implement InputPipeline() / OutputPipeline(). Use protected Send() for request/response.

Note
Inheritance-oriented. Not for direct generic use without a subclass.

Constructor & Destructor Documentation

◆ Client() [1/3]

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

Construct with a packet factory and a logger.

Parameters
deserialize_packet_functionBuilds domain packets from wire data.
loggerDiagnostic logger.

◆ Client() [2/3]

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

Copy constructor (deleted).

◆ Client() [3/3]

StormByte::Network::Client::Client ( Client &&  other)
defaultnoexcept

Move constructor.

◆ ~Client()

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

Destructor (out-of-line in .cxx).

Member Function Documentation

◆ Connect()

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

Connect to a remote host.

Parameters
protocolAddress family.
addressHostname or IP.
portPort number.
Returns
true on success.

Implements StormByte::Network::Endpoint.

◆ Disconnect()

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

Disconnect if connected.

Implements StormByte::Network::Endpoint.

◆ operator=() [1/2]

Client & StormByte::Network::Client::operator= ( Client &&  other)
defaultnoexcept

Move assignment.

◆ operator=() [2/2]

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

Copy assignment (deleted).

◆ Send()

PacketPointer StormByte::Network::Client::Send ( const Transport::Packet packet)
protectednoexcept

Send packet and return the response (or nullptr).

Parameters
packetRequest packet.
Returns
Response, or nullptr on error.

◆ Status()

Connection::Status StormByte::Network::Client::Status ( ) const
overridevirtualnoexcept

Current connection status.

Returns
Status.

Implements StormByte::Network::Endpoint.


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