COROIO: NNet::TSocketBase< void > Class Reference
COROIO
 
Loading...
Searching...
No Matches
NNet::TSocketBase< void > Class Reference

Internal base class encapsulating a socket (or file) descriptor and its poller. More...

#include <socket.hpp>

Public Member Functions

TPollerBasePoller ()
 Returns the poller associated with this socket.
 

Protected Member Functions

 TSocketBase (TPollerBase &poller, int domain, int type)
 
 TSocketBase (int fd, TPollerBase &poller)
 
int Create (int domain, int type)
 Creates a new socket descriptor.
 
int Setup (int s)
 Performs additional setup on the socket descriptor.
 

Protected Attributes

TPollerBasePoller_ = nullptr
 
int Fd_ = -1
 

Detailed Description

Internal base class encapsulating a socket (or file) descriptor and its poller.

This class stores a file descriptor and a pointer to a poller (TPollerBase) to support asynchronous I/O operations. It provides functionality to create a new socket descriptor (via Create()) and to set it up (via Setup()). Additionally, it holds the descriptor and allows cleanup via Close().

Note
This class is intended solely for internal use within the library. End-users should not interact directly with this class; instead, use the higher-level wrapper classes: TSocket, TFileHandle, TPollerDrivenSocket, or TPollerDrivenFileHandle.

Member Function Documentation

◆ Create()

int NNet::TSocketBase< void >::Create ( int  domain,
int  type 
)
protected

Creates a new socket descriptor.

Parameters
domainThe protocol family of the socket.
typeThe type of socket.
Returns
The socket descriptor on success, or -1 on failure.

◆ Poller()

TPollerBase * NNet::TSocketBase< void >::Poller ( )
inline

Returns the poller associated with this socket.

Returns
A pointer to the TPollerBase responsible for managing asynchronous events.

◆ Setup()

int NNet::TSocketBase< void >::Setup ( int  s)
protected

Performs additional setup on the socket descriptor.

This method may set socket options and configure the descriptor as needed.

Parameters
sThe socket descriptor to set up.
Returns
A status code indicating success or failure.

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