开发者

How get all identifiers of a host using c++?

In my c++ application I want to detect if two host identifiers (name or/and IP) are pointing to same host (including local and net IPs). For example "google.com" and "209.85.148.105" are same, "127.0.0.1" is possibly same with any host iden开发者_JS百科tifier.

In other words there is a function:

bool test_host(std::string const & host, std::set<std::string, case_insensitive_comparator> const & host_ids)
{
    return host_ids.find(host) != host_ids.end();
}

But I don't know how to generate host_ids. So how should I do?

P.S. My application is cross-platform and I would like to get such an answer which will work for both unix and windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜