| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
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:
[legend]

## Public Member Functions

| socket_events ()=default
| Default constructor.
| 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.

## Public Attributes

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

## 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_fd | file descriptor
  _flags | initial flags bitmask
  read_event | read ready event
  write_event | write ready event
  error_event | error 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 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0