SplitHostPort

Splits socket address string into host string and port value. Validates port value.

Synopsis

Declared in <util/strencodings.h>

bool
SplitHostPort(
    std::string_view in,
    uint16_t& portOut,
    std::string& hostOut);

Return Value

true if port-portion is absent or within its allowed range, otherwise false

Parameters

NameDescription
in [in]The socket address string to split.
portOut [out]Port-portion of the input, if found and parsable.
hostOut [out]Host-portion of the input, if found.