GNSContext class

Constructors, destructors, conversion operators

GNSContext() defaulted
~GNSContext()

Public functions

auto Initialize(GNSStatusChangedFn statusFn = nullptr) -> bool
void Shutdown()
Tear down the GNS library. Safe to call multiple times or if never initialized.
void Poll(int msWait = 0)
auto GetInterface() const -> const SocketHandle&
Returns the GNS interface pointer. nullptr if not initialized.
auto IsInitialized() const -> bool

Function documentation

bool GNSContext::Initialize(GNSStatusChangedFn statusFn = nullptr)

Initialize the GNS library. Must be called before any socket operations. GNS runs in manual poll mode — the background service thread is never spawned. Call Poll() from your NetThread to drive all GNS I/O inline. statusFn is invoked during Poll() when connection state changes.

void GNSContext::Poll(int msWait = 0)

Drive GNS I/O inline. Call once per NetThread tick before RunCallbacks(). msWait=0: non-blocking (process pending I/O and return immediately).