Beispiel #1
0
string g_NetService_gethostname(const string& ip_or_hostname)
{
    string hostname(CSocketAPI::gethostbyaddr(
        g_NetService_gethostbyname(ip_or_hostname), eOn));
    if (hostname.empty()) {
        NCBI_THROW_FMT(CNetServiceException, eCommunicationError,
            "g_NetService_gethostname('" << ip_or_hostname << "') failed");
    }
    return hostname;
}
Beispiel #2
0
static SServerAddress* s_GetFallbackServer()
{
    if (s_FallbackServer_Initialized)
        return s_FallbackServer->get();
    try {
        string host, port;
        if (NStr::SplitInTwo(TCGI_NetCacheFallbackServer::GetDefault(),
                ":", host, port)) {
            s_FallbackServer->reset(new SServerAddress(
                    g_NetService_gethostbyname(host),
                            (unsigned short) NStr::StringToInt(port)));
        }
    } catch (...) {
    }
    s_FallbackServer_Initialized = true;
    return s_FallbackServer->get();
}
Beispiel #3
0
string g_NetService_gethostip(const string& ip_or_hostname)
{
    return CSocketAPI::ntoa(g_NetService_gethostbyname(ip_or_hostname));
}