D++ (DPP)
C++ Discord API Bot Library
|
Represents an active socket event set in the socket engine. More...
#include <socketengine.h>
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... | |
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).
|
inline |
Construct a new socket_events.
socket_fd | file descriptor |
_flags | initial flags bitmask |
read_event | read ready event |
write_event | write ready event |
error_event | error event |
|
default |
Default constructor.
dpp::socket dpp::socket_events::fd {INVALID_SOCKET} |
File descriptor.
This should be a valid file descriptor created via socket().
uint8_t dpp::socket_events::flags {0} |
Flag bit mask of values from dpp::socket_event_flags.
socket_error_event dpp::socket_events::on_error {} |
Error event.
socket_read_event dpp::socket_events::on_read {} |
Read ready event.
socket_write_event dpp::socket_events::on_write {} |
Write ready event.