Skip to content

class flake::ServerWire

Abstract base class for server-side wire implementations. More...

#include <platform/flake/ServerWire.h>

Public Functions

Name
virtual~ServerWire() =default
virtual intinit() =0
Initialize the server wire (bind, listen, etc.).
virtual Wire *accept() =0
Block until a new client connects and return the resulting Wire.
virtual boolavailable() =0
Check whether the server wire is ready to accept connections.
virtual constchar *describe() =0
Return a human-readable description of this wire (e.g. "TCP:9986").
virtual unsignedstackSizeBytes() =0
Suggested stack size (in bytes) for the accept thread.
virtual voidclose() =0
Close the server wire and stop accepting new connections.

Protected Functions

Name
ServerWire() =default
ServerWire(constServerWire & ) =deleted
ServerWire &operator=(constServerWire & ) =deleted
ServerWire(ServerWire && ) =deleted
ServerWire &operator=(ServerWire && ) =deleted

Detailed Description

cpp
class flake::ServerWire;

Abstract base class for server-side wire implementations.

Note: The class is non-copyable and non-movable by design.

A ServerWire is the listening end of a transport. The router calls accept() in a loop to obtain connected Wire instances for each new client.

Public Functions Documentation

function ~ServerWire

cpp
virtual ~ServerWire() =default

function init

cpp
virtual int init() =0

Initialize the server wire (bind, listen, etc.).

Return: E_OK on success, or a negative error code.

function accept

cpp
virtual Wire * accept() =0

Block until a new client connects and return the resulting Wire.

Return: Pointer to a newly accepted Wire, or nullptr on failure.

The caller takes ownership of the returned Wire pointer.

function available

cpp
virtual bool available() =0

Check whether the server wire is ready to accept connections.

Return: true if the wire is available, false otherwise.

function describe

cpp
virtual constchar * describe() =0

Return a human-readable description of this wire (e.g. "TCP:9986").

Return: Null-terminated C string. The pointer remains valid for the lifetime of the ServerWire object.

function stackSizeBytes

cpp
virtual unsigned stackSizeBytes() =0

Suggested stack size (in bytes) for the accept thread.

Return: Stack size in bytes.

Implementations should return a sensible default for the platform.

function close

cpp
virtual void close() =0

Close the server wire and stop accepting new connections.

Protected Functions Documentation

function ServerWire

cpp
ServerWire() =default

function ServerWire

cpp
ServerWire(
    constServerWire & 
) =deleted

function operator=

cpp
ServerWire & operator=(
    constServerWire & 
) =deleted

function ServerWire

cpp
ServerWire(
    ServerWire && 
) =deleted

function operator=

cpp
ServerWire & operator=(
    ServerWire && 
) =deleted