D++ (DPP)
C++ Discord API Bot Library
dpp::socket_events Struct Reference

Represents an active socket event set in the socket engine. More...

#include <socketengine.h>

+ Collaboration diagram for dpp::socket_events:

Public Member Functions

 socket_events (dpp::socket socket_fd, uint8_t _flags, const socket_read_event &read_event, const socket_write_event &write_event={}, const socket_error_event &error_event={})
 Construct a new socket_events. More...
 
 socket_events ()=default
 Default constructor. More...
 

Public Attributes

dpp::socket fd {INVALID_SOCKET}
 File descriptor. More...
 
uint8_t flags {0}
 Flag bit mask of values from dpp::socket_event_flags. More...
 
socket_read_event on_read {}
 Read ready event. More...
 
socket_write_event on_write {}
 Write ready event. More...
 
socket_error_event on_error {}
 Error event. More...
 

Detailed Description

Represents an active socket event set in the socket engine.

An event set contains a file descriptor, a set of event handler callbacks, and a set of bitmask flags which indicate which events it wants to receive. It is possible to quickly toggle event types on or off, as it is not always necessary or desired to receive all events all the time, in fact doing so can cause an event storm which will consume 100% CPU (e.g. if you request to receive write events all the time).

Constructor & Destructor Documentation

◆ socket_events() [1/2]

dpp::socket_events::socket_events ( dpp::socket  socket_fd,
uint8_t  _flags,
const socket_read_event read_event,
const socket_write_event write_event = {},
const socket_error_event error_event = {} 
)
inline

Construct a new socket_events.

Parameters
socket_fdfile descriptor
_flagsinitial flags bitmask
read_eventread ready event
write_eventwrite ready event
error_eventerror event

◆ socket_events() [2/2]

dpp::socket_events::socket_events ( )
default

Default constructor.

Member Data Documentation

◆ fd

dpp::socket dpp::socket_events::fd {INVALID_SOCKET}

File descriptor.

This should be a valid file descriptor created via socket().

◆ flags

uint8_t dpp::socket_events::flags {0}

Flag bit mask of values from dpp::socket_event_flags.

◆ on_error

socket_error_event dpp::socket_events::on_error {}

Error event.

Note
This function will be called from a different thread to that which adds the event set to the socket engine.

◆ on_read

socket_read_event dpp::socket_events::on_read {}

Read ready event.

Note
This function will be called from a different thread to that which adds the event set to the socket engine.

◆ on_write

socket_write_event dpp::socket_events::on_write {}

Write ready event.

Note
This function will be called from a different thread to that which adds the event set to the socket engine.
D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0