EasySockets v2.0.0
A simple, cross platform socket library for C++.
Loading...
Searching...
No Matches

An object which is required to exist for es::Sockets to be used. More...

#include <PosixContext.hpp>

Public Member Functions

 PosixContext ()=default
 PosixContext (const PosixContext &)=delete
PosixContextoperator= (const PosixContext &)=delete
 PosixContext (PosixContext &&other) noexcept=default
PosixContextoperator= (PosixContext &&other) noexcept
 ~PosixContext ()=default
void shutdown ()
 Terminates the context.

Detailed Description

An object which is required to exist for es::Sockets to be used.

This ensures that any underlying setup and cleanup code is called.
For example: es::Context context{}; // must be created before any sockets are created es::Socket socket{es::IpVersion::ipv4, es::Protocol::tcp}; socket.bind({"0.0.0.0", 8080});
Can be moved from but not copied. Members are the same across all implementations.

Constructor & Destructor Documentation

◆ PosixContext() [1/3]

es::PosixContext::PosixContext ( )
default

◆ PosixContext() [2/3]

es::PosixContext::PosixContext ( const PosixContext & )
delete

◆ PosixContext() [3/3]

es::PosixContext::PosixContext ( PosixContext && other)
defaultnoexcept

◆ ~PosixContext()

es::PosixContext::~PosixContext ( )
default

Member Function Documentation

◆ operator=() [1/2]

PosixContext & es::PosixContext::operator= ( const PosixContext & )
delete

◆ operator=() [2/2]

PosixContext & es::PosixContext::operator= ( PosixContext && other)
noexcept

◆ shutdown()

void es::PosixContext::shutdown ( )
inline

Terminates the context.

Will be called when destructor is called.