Lookup

Resolve a service string to its first corresponding service.

Synopsis

Declared in <netbase.h>

std::optional<CService>
Lookup(
    std::string const& name,
    uint16_t portDefault,
    bool fAllowLookup,
    DNSLookupFn dns_lookup_function = g_dns_lookup);

Return Value

The first resolved service, or std::nullopt if the string does not resolve.

Parameters

NameDescription
nameThe service string to resolve.
portDefaultThe port to use when the service string omits one.
fAllowLookupWhether DNS lookups are permitted.
dns_lookup_functionThe resolver used to perform the lookup.

See Also

Lookup(const std::string&, uint16_t, bool, unsigned int, DNSLookupFn) for additional parameter descriptions.