示例代码如下:
#include <iostream>
using namespace std;
#include <boost/asio/ip/tcp.hpp >
using namespace boost;
//用来保存IP地址、域名、IP地址的类型、主机的端口或服务名称
typedef boost::asio::ip::tcp::resolver::query CQuery;
void main()
{
CQuery oQuery("www.boost.org", "http");
cout << "HostName : " << oQuery.host_name() << endl;
cout << "ServiceName : " << oQuery.service_name() << endl;
}