Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::SocketDNS Struct Reference

Synchronous DNS Resolution. More...

#include <SocketDescriptor.h>

Static Public Member Functions

static Result resolveDNS (StringView host, String &ipAddress)
 Resolve an host string to an ip address (blocking until DNS response arrives) More...
 

Detailed Description

Synchronous DNS Resolution.

Example:

SmallString<256> ipAddress;
SC_TEST_EXPECT(SocketDNS::resolveDNS("localhost", ipAddress));
SC_TEST_EXPECT(ipAddress.view() == "127.0.0.1");
#define SC_TEST_EXPECT(e)
Records a test expectation (eventually aborting or breaking o n failed test)
Definition: Testing.h:113
static Result resolveDNS(StringView host, String &ipAddress)
Resolve an host string to an ip address (blocking until DNS response arrives)

Member Function Documentation

◆ resolveDNS()

static Result SC::SocketDNS::resolveDNS ( StringView  host,
String ipAddress 
)
static

Resolve an host string to an ip address (blocking until DNS response arrives)

Parameters
[in]hostThe host string (example.com)
[out]ipAddressThe ip address of the given host string
Returns
Valid Result if ip address for the passed host has been successfully resolved

Example:

SmallString<256> ipAddress;
SC_TEST_EXPECT(SocketDNS::resolveDNS("localhost", ipAddress));
SC_TEST_EXPECT(ipAddress.view() == "127.0.0.1");

The documentation for this struct was generated from the following file: