![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
A socket address. More...
#include <gf/SocketAddress.h>
Public Types | |
using | StorageLengthType = implementation-defined |
The type to handle the storage length. More... | |
Public Member Functions | |
SocketAddress ()=default | |
Default constructor. More... | |
SocketFamily | getFamily () const |
Get the family of the socket address. More... | |
std::string | getHostname (SocketAddressFormat format=SocketAddressFormat::Unrestricted) const |
Get the hostname associated to the address. More... | |
std::string | getService (SocketAddressFormat format=SocketAddressFormat::Unrestricted) const |
Get the service associated to the address. More... | |
SocketAddress (sockaddr *a_storage, StorageLengthType a_length) | |
Constructor with a raw sockaddr and a length. More... | |
const sockaddr * | asSockAddr () const |
Get the storage as a sockaddr address. More... | |
Public Attributes | |
sockaddr_storage | storage |
The storage for the address. More... | |
StorageLengthType | length |
The length of the address. More... | |
A socket address.
A socket address is composed of an IP address (representing an hostname) and a port number (representing a service).
You can not create a socket address directly.
In other libraries, it can also be called "endpoint".
using gf::SocketAddress::StorageLengthType = implementation-defined |
The type to handle the storage length.
|
default |
Default constructor.
gf::SocketAddress::SocketAddress | ( | sockaddr * | a_storage, |
StorageLengthType | a_length | ||
) |
Constructor with a raw sockaddr and a length.
|
inline |
Get the storage as a sockaddr address.
SocketFamily gf::SocketAddress::getFamily | ( | ) | const |
Get the family of the socket address.
std::string gf::SocketAddress::getHostname | ( | SocketAddressFormat | format = SocketAddressFormat::Unrestricted | ) | const |
Get the hostname associated to the address.
format | The format of the socket address |
std::string gf::SocketAddress::getService | ( | SocketAddressFormat | format = SocketAddressFormat::Unrestricted | ) | const |
Get the service associated to the address.
format | The format of the socket address |
StorageLengthType gf::SocketAddress::length |
The length of the address.
sockaddr_storage gf::SocketAddress::storage |
The storage for the address.