D++ (DPP)
C++ Discord API Bot Library
|
Represents an IPv4 address for use with socket functions such as bind(). More...
#include <socket.h>
Public Member Functions | |
address_t (const std::string_view ip="0.0.0.0", uint16_t port=0) | |
Create a new address_t. More... | |
sockaddr * | get_socket_address () |
Get sockaddr. More... | |
size_t | size () |
Returns size of sockaddr_in. More... | |
uint16_t | get_port (socket fd) |
Get the port bound to a file descriptor. More... | |
Represents an IPv4 address for use with socket functions such as bind().
Avoids type punning with C style casts from sockaddr_in to sockaddr pointers.
dpp::address_t::address_t | ( | const std::string_view | ip = "0.0.0.0" , |
uint16_t | port = 0 |
||
) |
Create a new address_t.
ip | IPv4 address |
port | Port number |
uint16_t dpp::address_t::get_port | ( | socket | fd | ) |
Get the port bound to a file descriptor.
fd | File descriptor |
sockaddr * dpp::address_t::get_socket_address | ( | ) |
Get sockaddr.
size_t dpp::address_t::size | ( | ) |
Returns size of sockaddr_in.