COROIO: NNet::THostPort Class Reference
COROIO
 
Loading...
Searching...
No Matches
NNet::THostPort Class Reference

A host:port pair that resolves to a TAddress. More...

#include <resolver.hpp>

Public Member Functions

 THostPort (const std::string &hostPort)
 Parses a "host:port" string.
 
 THostPort (const std::string &host, int port)
 Constructs from separate host and port values.
 
TFuture< TAddressResolve (TResolver &resolver)
 Resolves the host to a TAddress using the given resolver.
 
const std::string ToString () const
 
const std::string & GetHost () const
 
int GetPort () const
 

Detailed Description

A host:port pair that resolves to a TAddress.

If host is a literal IPv4 or IPv6 address, Resolve() returns immediately without querying DNS. Otherwise it delegates to TResolver::Resolve().

TAddress addr = co_await THostPort("example.com", 443).Resolve(resolver);
TAddress ip = co_await THostPort("127.0.0.1", 8080).Resolve(resolver); // no DNS
A class representing an IPv4 or IPv6 address (with port).
Definition address.hpp:38
A host:port pair that resolves to a TAddress.
Definition resolver.hpp:261
TFuture< TAddress > Resolve(TResolver &resolver)
Resolves the host to a TAddress using the given resolver.
Definition resolver.hpp:274

Member Function Documentation

◆ Resolve()

TFuture< TAddress > NNet::THostPort::Resolve ( TResolver resolver)
inline

Resolves the host to a TAddress using the given resolver.

Skips DNS if host is already a literal IP. Throws std::runtime_error if DNS returns no addresses.


The documentation for this class was generated from the following files: