src/netbase.cpp
bool Lookup(const std::string& name, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
{
    if (name.empty() || !ValidAsCString(name)) {
        return false;
    }
    int port = portDefault;
    std::string hostname;
    SplitHostPort(name, port, hostname);

    std::vector<CNetAddr> vIP;
    bool fRet = LookupIntern(hostname, vIP, nMaxSolutions, fAllowLookup);
    if (!fRet)
        return false;
    vAddr.resize(vIP.size());
    for (unsigned int i = 0; i < vIP.size(); i++)
        vAddr[i] = CService(vIP[i], port);
    return true;
}
/**
 * Resolve a service string to its corresponding service.
 *
 * @param name    The string representing a service. Could be a name or a
 *                numerical IP address (IPv6 addresses should be in their
 *                disambiguated bracketed form), optionally followed by a port
 *                number. (e.g. example.com:8333 or
 *                [2001:db8:85a3:8d3:1319:8a2e:370:7348]:420)
 * @param[out] vAddr The resulting services to which the specified service string
 *                   resolved.
 * @param portDefault The default port for resulting services if not specified
 *                    by the service string.
 * @param fAllowLookup Whether or not hostname lookups are permitted. If yes,
 *                     external queries may be performed.
 * @param nMaxSolutions The maximum number of results we want, specifying 0
 *                      means "as many solutions as we get."
 *
 * @returns Whether or not the service string successfully resolved to any
 *          resulting services.
 */
Resolve a service string to its corresponding service.
@param name    The string representing a service. Could be a name or a
numerical IP address (IPv6 addresses should be in their
disambiguated bracketed form), optionally followed by a port
number.
@param[out] vAddr The resulting services to which the specified service string
resolved.
@param portDefault The default port for resulting services if not specified
by the service string.
@param fAllowLookup Whether or not hostname lookups are permitted. If yes,
external queries may be performed.
@param nMaxSolutions The maximum number of results we want, specifying 0
means "as many solutions as we get."

@returns Whether or not the service string successfully resolved to any
resulting services.
Resolve a service string to its corresponding service . @param name The string representing a service . Could be a name or a numerical IP address ( IPv6 addresses should be in their disambiguated bracketed form ) optionally followed by a port number . @param [ out ] vAddr The resulting services to which the specified service string resolved . @param portDefault The default port for resulting services if not specified by the service string . @param fAllowLookup Whether or not hostname lookups are permitted . If yes external queries may be performed . @param nMaxSolutions The maximum number of results we want specifying 0 means " as many solutions as we get . " @returns Whether or not the service string successfully resolved to any resulting services .
bool Lookup(const std::string& name, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
{
    if (name.empty() || !ValidAsCString(name)) {
        return false;
    }
    int port = portDefault;
    std::string hostname;
    SplitHostPort(name, port, hostname);
    std::vector<CNetAddr> vIP;
    bool fRet = LookupIntern(hostname, vIP, nMaxSolutions, fAllowLookup);
    if (!fRet)
        return false;
    vAddr.resize(vIP.size());
    for (unsigned int i = 0; i < vIP.size(); i++)
        vAddr[i] = CService(vIP[i], port);
    return true;
}
bool Lookup ( const std :: string & name , std :: vector < CService > & vAddr , int portDefault , bool fAllowLookup , unsigned int nMaxSolutions ) { if ( name . empty ( ) || ! ValidAsCString ( name ) ) { return false ; } int port = portDefault ; std :: string hostname ; SplitHostPort ( name , port , hostname ) ; std :: vector < CNetAddr > vIP ; bool fRet = LookupIntern ( hostname , vIP , nMaxSolutions , fAllowLookup ) ; if ( ! fRet ) return false ; vAddr . resize ( vIP . size ( ) ) ; for ( unsigned int i = 0 ; i < vIP . size ( ) ; i ++ ) vAddr [ i ] = CService ( vIP [ i ] , port ) ; return true ; }
Resolve a service string to its corresponding service.
Resolve a service string to its corresponding service .