Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::SocketDNS Struct Reference

Synchronous DNS Resolution. More...

#include <Socket.h>

Static Public Member Functions

static Result resolveDNS (SpanStringView host, SpanString &ipAddress)
 Resolve an host string to an ip address (blocking until DNS response arrives)
 

Detailed Description

Synchronous DNS Resolution.

Example:

char buffer[256] = {0};
SpanString ipAddress = buffer;
SC_TEST_EXPECT(SocketDNS::resolveDNS("localhost", ipAddress));
SC_TEST_EXPECT(StringView(ipAddress.text, true, StringEncoding::Ascii) == "127.0.0.1");

Member Function Documentation

◆ resolveDNS()

static Result SC::SocketDNS::resolveDNS ( SpanStringView host,
SpanString & ipAddress )
staticnodiscard

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:

char buffer[256] = {0};
SpanString ipAddress = buffer;
SC_TEST_EXPECT(SocketDNS::resolveDNS("localhost", ipAddress));
SC_TEST_EXPECT(StringView(ipAddress.text, true, StringEncoding::Ascii) == "127.0.0.1");

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