Network modul.
More...
#include <net.hpp>
|
| net ()=delete |
| Deleted explicit constructor.
|
|
|
static ipv4 | resolve (std::string const &hostname, uint16_t port=0) |
| Resolves a hostname to a wze::ipv4 address.
|
|
static std::string | resolve (ipv4 const &address) |
| Resolves an wze::ipv4 address to a hostname.
|
|
Network modul.
- See also
- socket
-
udp_socket
-
tcp_socket
Definition at line 47 of file net.hpp.
◆ resolve() [1/2]
wze::ipv4 wze::net::resolve |
( |
std::string const & | hostname, |
|
|
uint16_t | port = 0 ) |
|
staticnodiscard |
Resolves a hostname to a wze::ipv4 address.
- Parameters
-
hostname | Hostname of the server. |
port | Port of the server. |
- Returns
- Resolved wze::ipv4 address.
- Exceptions
-
Definition at line 35 of file net.cpp.
35 {
37 if ((bool)SDLNet_ResolveHost(&address, hostname.c_str(), port)) {
38 throw exception<net_error>{{SDLNet_GetError()}};
39 }
40 return {address};
41}
IPaddress ipv4
IPv4 address.
◆ resolve() [2/2]
std::string wze::net::resolve |
( |
ipv4 const & | address | ) |
|
|
staticnodiscard |
Resolves an wze::ipv4 address to a hostname.
- Parameters
-
- Returns
- Resolved hostname.
- Exceptions
-
Definition at line 43 of file net.cpp.
43 {
44 char const* hostname{SDLNet_ResolveIP(&address)};
45 if (!(bool)hostname) {
46 throw exception<net_error>{{SDLNet_GetError()}};
47 }
48 return {hostname};
49}
The documentation for this class was generated from the following files: